RUVIDEO
Поделитесь видео 🙏

#6.1 Java Tutorial | Inheritance смотреть онлайн

In this lecture we are discussing :
1)What is inheritance?
2)With example and scenario we understand what is inheritance?
3)Multilevel inheritance
4)Type of relationship

#1
In OOPs inheritance is a process of inheriting the properties of one class to another class.
e.g suppose a class has some property and behaviour and want this behaviour and properties to new class with additional property
we are using inheritance to inherit the property of one class to another.

#2
Scenario based example
Suppose we hire a developer and want to made Calculator which can add
two number.
Step 1:
Developer A - created Calc class which has add method and provide .class file to me but not provide source code file.
class Calc {
public void add(int num1,int num2){
System.out.println(num1+num2);
}
}

Now i removed that developer from his post and hire new developer but we want to add subtraction functionality to Calculator.
But problem is that if we have Calc class source file then we said to developer B to add subtraction method.
Step 2:
When we have source code file
then,
class CalcAdv{
public void add(int num1,int num2){
System.out.println(num1+num2);
}
public void sub(int num1,int num2){
System.out.println(num1-num2);
}
}

But developer A does not provide Calc source code we have only Calc .class file.
Now we have one concept of OOPs that can help the developer B.

Step 3:
Now we have concept of inheritance in OOPs
lets us use extending or inheriting method from Calc class.

//inheriting add method from calc
class CalcAdv extends Calc{
public void sub(int num1,int num2){
System.out.println(num1-num2);
}
}


class Main{
public static void main(String []args){
CalcAdv obj=new CalcAdv();
obj.add(5,4);
obj.sub(5,4); //now we can use addition and subtraction functionality
}
}

:- This is know as single level inheritance

#3
Multilevel inheritance
class Calc{
public void add(int num1,int num2){
System.out.println(num1+num2);
}
}
class CalcAdv extends Calc{
public void sub(int num1,int num2){
System.out.println(num1-num2);
}

//Now we can use the property and methods of Calc also
//Single level inheritence
}

class CalcSuperAdv extends CalcAdv{
public void mul(int num1,int num2){
System.out.println(num1*num2);

//But here you can use the property and methods of Calc as well as CalcAdv class
//multilevel inheritance we consider Calc, CalcAdv and CalcSuperAdv
}
}

Note:i) Multilevel inheritance allowed in java but Multiple inheritance not allowed in java we shall understand why this not allowed in next lecture
ii)Term- {super, parent, base}-- same meaning and {sub, child, derived}--same meaning

#4
Type of relationship
i)IS-A relationship means one class is a child of another class.
e.g
class Animal{

}
class Lion extends Animal{
//here we found Lion is a animal
}

ii)HAS-A relationship means one class has using property and method of other class but that class is not a parent of current class.
class Bank{
void withdrawMoney(){
System.out.println("withdrawl);
}
}

class Hospital{
A obj=new A();
void accessMoney{
obj.withdrawMoney();
}
//here we can see a hospital has a bank access
}



Instagram : https://www.instagram.com/navinreddyofficial/
Linkedin : https://in.linkedin.com/in/navinreddy20
Discord : https://discord.gg/aXPF5hV7

More Learning :

Java - https://bit.ly/3xleOA2
Python :- https://bit.ly/3H0DYHx
Django :- https://bit.ly/3awMaD8
Spring Boot :- https://bit.ly/3aucCgB
Spring Framework :- https://bit.ly/3GRfxwe

Servlet & JSP :- https://bit.ly/3mh5CGz
Hibernate Tutorial :- https://bit.ly/3NWAKah
Rest API | Web Service Tutorial :- https://bit.ly/38RJCiy

Git :- https://bit.ly/3NUHB3V
JavaScript :- https://bit.ly/3mkcFys
Kotlin :- https://bit.ly/3GR2DOG


Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
http://www.telusko.com/contactus

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «#6.1 Java Tutorial | Inheritance» бесплатно и без регистрации, вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.