#48 What is Inheritance in Java

preview_player
Показать описание
Check out our courses:

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO10 (10% Discount)

Coupon: TELUSKO20 (20% Discount)

For More Queries WhatsApp or Call on : +919008963671

In this lecture we will learn:
- What is inheritance in Java?
- Use of extend keyword in inheritance
- The main aim of inheritance
- Important points related to inheritance

#1
For every class that we create in a code, there will be a class file.
- Inheritance helps to add more features by inheriting the class.
- For inheritance, we only required the class file. There is no need for a java file.
- extends keyword is used in inheritance to inherit properties of a parent class.

#2
- The main aim of inheritance is to implement the concept of reusability, saving our time and resources and also creating better connections between different classes, and achieving method overriding.

#3
Points related to inheritance in Java:-
- The superclass of every class is an Object class.
In the absence of any other explicit superclass, every class is implicitly a subclass of the Object class.
- A superclass can have any number of subclasses but a subclass can have only one superclass.
- Constructors are not members, so they are not inherited by subclasses, but the constructor of the superclass can be invoked from the subclass.
- A subclass does not inherit the private members of its parent class.

More Learning :

Donation:
PayPal Id : navinreddy20
Рекомендации по теме
Комментарии
Автор

No one else can teach like you man! you are helping people a lot. Thank you naveen.

bhuvanprasathk
Автор

"redundancy is crime"
- navin reddy

aakashsinha
Автор

I seriously waste my 2 years, if you met me before sir, I'll be good. Since last 7 days I feel super confident. Thank you sir

rohannJhaaaa
Автор

His simplicity makes things understandable for mediocre programmers like me, and the wits and jokes makes his videos a pleasure to watch. Thank you Telusko and Naveen for all the long years of tutorials... Praveen Chathukutty, from Kerala.

Praveen_Chathukutty
Автор

thank u so much navin sir, you are just amazing. the way you cleared my doubt is qwesome.

jeemaths
Автор

your videos helped me a lot sir, Thank you so much..

ShahriarShihab-lmjd
Автор

actually the your course is not for just the beginner … but what’s the good thing is that .. suppose there is a IT person who don’t study for a while and now he want to recall all then it’s perfect…. and the way you explain is not quickly hit to the new person but it helps when a person go to interview and if they will explain in your style 😂😂😂😂 it will surely selected bcz you are not tell us theory you tell us all practical knowledge which can be quick adopted by a IT Student 🙇🏻

niksyt
Автор

public class Main{
public static void main(String[] args) {
Advanced obj = new Advanced();
System.out.println(obj.add(8, 3));
System.out.println(obj.mult(8, 3));
System.out.println(obj.sub(4, 9));
System.out.println(obj.div(4, 9));
}
}

class Calc{

public int add(int n1, int n2){
return n1 + n2;
}

public int sub(int n1, int n2){
return n1 - n2;
}

}

class Advanced extends Calc{

public int mult(int n1, int n2){
return n1 * n2;
}

public int div(int n1, int n2){
return n1 / n2;
}
}

kvelez
Автор

hold "Shift+Alt+arrow down" to copy the lines in vscode

mrprofomedia
Автор

What an amazing lecture! I have one question. In this case, I think it is much easier if I just create two those methods, multi() and div(), in the class Calc. But why we should make another class, AdvCalc?

옥자-pr
Автор

Sir in my laptop it doesn't working with public keyword for classes.but without public keyword it executes
Why this problem is occurring

prathameshpatil
Автор

why you upload sir this series and you have also paid batch binary java batch so is difference in those course

Sehore_Defence_Academy
visit shbcf.ru