Java Tutorial – 3 | Edureka

Java Tutorial – 3 | Edureka

FavoriteLoadingAdd to favorites

Take instructor-led Live class on Java Tutorial at :


The following topics were covered in this Java Tutorial:

Defining & Importing Packages, Inheritance, Super Keyword, Method and Classes, Method Overloading, Method Overriding.

A Java package is a mechanism for organizing java classes into namespaces i.e you can give a particular name to the package. On that particular package you will find the classes you have included in that package.
Programmers use packages to organise classes belonging to the same category. So whatever class that we make in our application should consist of a package which makes the task of finding the class easy.
For example consider there are 4 classes providing a particular functionality to your application. So you like to have all those 4 classes to be present in the same package name. Hence you should make a package and include all these classes which are of same category. Classes in the same package can access each other’s package- access members.
Inheritance is nothing but a class can inherit a particular class in terms of java. Practical example is everyone has a father. Your father owns a particular property. After sometime you will be the owner of that property. You inherit the property after your father. Similarily in a class you can define particular things and inherit them in another class which is called as inheritance.
The child classes inherit all the attribute of the parent class. Like in a father and son’s relation, son inherits everything that a father has got. They also have their distinctive attribute.

We use extends keyword for inheritance. The advantage of inheritance is reusing the code. You can change the definition of variables and methods of parent class in its child class. Java does not support multiple inheritance.
Java OOP:
We create a new object type with class keyword. A class definition can contain: variables (fields), initialization code, methods.
An object is run time representation of class. Whenever you want to access the class then you have to create an object of that class. Object holds state with variables i.e every instance variable will have its own value. They do some work with methods. They can be created during run time only.
An object is an instance of class. A class is a collection of objects with similar parameters.
Whenever you want to create functionality then you make a method and call that method whenever that functionality is required. A method is a collection of statements that are grouped together to perform an operation. A method takes some parameters, performs some computations and then optionally returns a value (or object).
The difference between procedure and functions is that function returns something whereas procedure returns nothing.
Method have five components: modifiers, return type, method name, parameter list and method body
Modifiers specify where the method can be accessed .
Return type is nothing but the type of data that a method should return. If a method does not return anything then we use void keyword which indicate no return type.
Method name is the name of the method that you would like to assign.
Parameter list is the list of arguments which you want to pass to the method
Method body actually represents the functionality you would like to perform.
Method overloading:
The overloaded function must differ either by the number of arguments or operands or data types but with same name. So we are trying use same method name to perform different functions.
Method overriding:
The implementation in the sub class overrides (replaces) the implementation in the super class. It is done by providing a method that has same name, same type of parameters and same return type of method. So in method overriding the method signature will remain same.
Super keyword is used to call the method or variable in the parent class. Super keyword works only when there exists inheritance between them.
In both the method overloading and method overriding we are trying to use same method for different functionalities i.e method is acting in multiple forms which is nothing but polymorphism(acting in multiple forms) , an OOP concept.
If a method is declared final then that method cannot be overridden. The final keyword can also used for class. If we declare a class as final then that class cannot be inherited.

Please write back to us at or call us at +91-8880862004 for more information.

Visit –


By |2021-02-10T12:17:59+00:00February 10th, 2021|Java Video Tutorials|6 Comments


  1. ankita kaushik February 10, 2021 at 12:18 pm - Reply

    edureka,,nobody can deliver the java the way you do ,no words to thank u,it cant able express in words,,fabulous…..

  2. timepass February 10, 2021 at 12:18 pm - Reply

    Do you have tutorials for Data Structures and Algorithms? Java tutorials are great. Thanks.

  3. NKP February 10, 2021 at 12:18 pm - Reply

    Amazing videos. I finish them in 4 Days. Lovely way to revise what you know.

  4. BANGANIRIKI FIDELE February 10, 2021 at 12:18 pm - Reply

    Perfect tutorial!

  5. Warrio W February 10, 2021 at 12:18 pm - Reply

    At 26:27, the super class cannot have the attribute "lives on land" only. In this case, the class Aquatic cannot be a child of the class Animal because it does not live on land.

  6. Afsar Jan February 10, 2021 at 12:18 pm - Reply

    Normally what we do is to gain a a lot in no time. It's my exam and this video is too lengthy but still I am watching it. Nice one bro keep it up. 🙂 Thumbs Up for you. 🙂

Leave A Comment