Session 14- Java OOPS Concepts - Inheritance and Types of Inheritance in Java | 2024 New series

preview_player
Показать описание
#java#selenium#programming#inheritance#automation

#########################
Udemy Courses:
#########################

Manual Testing+Agile with Jira Tool
************************************

Selenium with Java+Cucumber
********************************

Selenium with Python & PyTest
********************************

Selenium with python using Robot framework
****************************************

API Testing(Postman, RestAssured & SoapUI)
*****************************************

Web & API Automation using Cypress with Javascript
********************************************

Playwright with Javascript
**************************

Jmeter-Performance Testing
************************

SDET Essencials(Full Stack QA)
*************************

Appium-Mobile Automation Testing
************************************

Java Collections
*****************

Python Programming
*********************

Cucumber BDD Framework
***************************

Protractor with Javascript
***************************

####################################
Youtube Playlists:
####################################

Manual Testing & Agile
***********************

SQL
****

linux & Shell Scripting
**********************

Java
*****

Selenium With Java+Cucumber
********************************

Python
***************************

Selenium With Python,Pytest&Behave
***************************************

Selenium With Python Using Robert Framework
(Web&API Testing)
*************************************************

API Testing (Postman,SoapUi,&Rest Assured)
**********************************************

Mobile App Testing Appium
****************************

Performance Testing Jmeter
*******************************

Maven,Jenkins,Git,Github,CI/CD
*******************************

SQL,DB Testing&ETL,Bigdata
*******************************

JavaScript Based Automation Tools
********************************

Selector Hub Tools
********************

GraphQL
******************

Cypress API Testing
********************

Cypress Web Testing
**********************

Playwright with Javascipt
**************************

#JavaOOPS
#Inheritance101
#ObjectOrientedProgramming
#JavaProgramming
#OOPSConcepts
#InheritanceTypes
#JavaInheritance
#CodeWithJava
#LearnJava
#ProgrammingFundamentals
#JavaDevelopment
#SoftwareEngineering
#JavaBasics
#AdvancedJava
#InheritanceHierarchy
#CodingInJava
#JavaClasses
#JavaObjects
#JavaMethods
#JavaInheritanceBasics
#OOPInheritance
#JavaTutorial
#JavaTraining
#JavaLearning
#InheritanceModels
#JavaCode
#JavaProgrammingLanguage
#ObjectOrientation
#JavaDevelopmentTips
#ProgrammingTips
#OOPConcepts
#InheritanceInJava
#Polymorphism
#Encapsulation
#Abstraction
#JavaDesignPatterns
#CodeLearning
#JavaDevelopmentCommunity
#SoftwareDevelopment
#JavaDevelopmentTools
#JavaForBeginners
#CodingTips
#JavaProjects
#SoftwareDesign
#ObjectOrientedDesign
#JavaCodingSkills
#OOPPrinciples
#JavaExperts
#JavaMastery
#JavaWorld
Рекомендации по теме
Комментарии
Автор

Sir I following you from 1 year and I took your Udemy course also..2 month back I received 2 offer because of your course.. Thankyou so much..I have no words to Thankyou..

Sud
Автор

A brilliant way of teaching.. nice examples broken down and explained perfectly.

stevenclark
Автор

Excellent Sir ❤❤❤ thank you for such videos, now i am get better understanding of this topics ❤❤❤

A_Motivation
Автор

Waiting for Abstraction and Interfaces which is very important and confusing. Hope my confusion will clear today.

neelasumanth
Автор

Thank you for the detailed explanation .

nagasaimaddula
Автор

I was following your videos i am learning this course sir

It was very wonderful to understand easy to learn from this video contain information ❤

SVRhappy
Автор

best teacher for the basic to high about the java

sourabhramteke
Автор

Sir thanks for your videos, with the help these videos i got the job... thankyou so much sir😊

ShaikAmanullah
Автор

Sir thank you from the bottom of my heart. Your video helped me a lot to get a job😢.you are god to me.🙏

ashutoshswain
Автор

Thanks to you i am done with manual testing, and i am right now into automation testing

PreciousEvhameh
Автор

Thank you so much sir, Every time i am learning something new from your session..

sirisharayaprolu
Автор

Thank you so much! I really enjoyed this session. My confusion about multiple inheritance is now clear. Every session with you has helped me understand things better and added to my knowledge. I appreciate your guidance! Waiting for the next session. please upload it as soon as possible sir.

numeshialmapiyasiri
Автор

Perfectly explained sir. Thank you so much.

abhishekshahi
Автор

In every journey god send some mentors to help you. You are one of them for this journey. Thank you sir ❣

sangeetasingh
Автор

It's very easy to understand even beginers also Tq soo much sir 🎉🎉🎉🎉🎉🎉🎉🎉🎉

spectruminfo.official
Автор

waiting for more videos on abstraction , ,interfaces, files , exception handling and also advanced java

siddharthsidd-ii
Автор

The explanation just too good to miss out on

Nimmi
Автор

Devudu sir meeru, nenu ekkada ilanti explanation chudaledhu, thank you sir 🙏

jayasuryak
Автор

*Why multiple inheritance is not allowed in inheritance concept?*

A. In Java, *multiple inheritance* is not allowed with classes to avoid complexity and ambiguity. Let me explain this in detail.

### What is Inheritance?
Inheritance allows one class (called a subclass or derived class) to inherit the properties (fields and methods) from another class (called a superclass or base class). In Java, inheritance is achieved using the `extends` keyword.

For example:
```java
class Animal {
void eat() {
System.out.println("This animal eats food.");
}
}

class Dog extends Animal {
void bark() {
System.out.println("The dog barks.");
}
}

public class Main {
public static void main(String[] args) {
Dog d = new Dog();
d.eat(); // Inherited method
d.bark(); // Dog's own method
}
}
```
Here, the `Dog` class inherits the `eat()` method from the `Animal` class.

### Why is Multiple Inheritance Not Allowed in Java?

Multiple inheritance refers to the ability of a class to inherit from more than one class. Java restricts this feature with classes to avoid the **"Diamond Problem"** and **increased complexity**.

#### The Diamond Problem:
Let’s consider an example to understand the issue with multiple inheritance.

1. Imagine you have two classes, `ClassA` and `ClassB`, and both have a method with the same name `display()`.
2. Now, you create a new class `ClassC` that inherits from both `ClassA` and `ClassB`.

```java
class ClassA {
void display() {
System.out.println("Display method from ClassA");
}
}

class ClassB {
void display() {
System.out.println("Display method from ClassB");
}
}

// Now, imagine ClassC tries to inherit from both ClassA and ClassB
class ClassC extends ClassA, ClassB {
// Which display() method should ClassC inherit?
}
```

Here comes the **ambiguity**:
- If `ClassC` inherits from both `ClassA` and `ClassB`, and you try to call the `display()` method, the compiler will not know whether to use the method from `ClassA` or `ClassB`. This ambiguity is known as the *Diamond Problem*.

Java avoids this situation by *not allowing multiple inheritance* with classes. It simplifies the class hierarchy and prevents potential conflicts that may arise from this ambiguity.

### How Java Solves the Problem:
Java allows *multiple inheritance using interfaces*, which provides a cleaner solution. An interface only defines method signatures without providing the actual implementation. This way, classes implementing multiple interfaces must provide their own implementation for the methods, avoiding the ambiguity.

#### Example with Interfaces in Java:
```java
interface InterfaceA {
void display();
}

interface InterfaceB {
void display();
}

class ClassC implements InterfaceA, InterfaceB {
// Must provide implementation of display method
public void display() {
System.out.println("Display method from ClassC");
}

public static void main(String[] args) {
ClassC c = new ClassC();
c.display(); // No ambiguity here, because ClassC provides its own implementation
}
}
```
In this case, `ClassC` implements both `InterfaceA` and `InterfaceB`, and provides its own implementation of the `display()` method, thus avoiding the issue of ambiguity.

### Conclusion:
Java doesn't support multiple inheritance with classes to prevent ambiguity and reduce complexity in the class hierarchy. Instead, Java uses interfaces to achieve similar functionality, but in a way that avoids the problems associated with multiple inheritance.

sainithinp
Автор

In multi level inheritance if x have run() method and y also have run() method and y extends x and z is another class which extends y so eventually z also faces ambiguity as both x and y have run () method in common

tanyagarg