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..
I watched a lot of content on RUclips, but the way Sir explains is on another level and very easy to understand. Before watching this video, I was a bit confused about multiple inheritance, but now I feel very confident about the concept. Thank you, Sir
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.
*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.
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
sir i have to cover this syallusbus fast so do you have any other resource , bcz i am in final semeter of my final year left with only 2.5 month and any how i have to find placement in Qa
sir i faced one of the interview question like this.. if in the parent class methods or variables are protected or private then can you inherit the methods or variables from parent .. can you explain this topic also sir.. will help for us..
As far as variables are concerned. If parent's class variables are PRIVATE, even if you inherit the Parent Class in your Child Class. You will not have access to those variables. If the parent class variables are PROTECTED, then you can have access to these variables in the same class, different class same package, derived class same package, derived class different package, but NOT to different class different package.
Amazing, Thanks a lot, Hats off to you Sir@@sdetpavan. Actually I've taken a 3 months of break to switch into automation as I have work exp. of 3 yrs in Tech Mahindra. I've joined a class but its not much effective but then I came across with your videos. I've done Lambda expression, streams, collection series of yours & now sticking with this series. I'm so glad that I'm blessed with you at this moment. Hopefully you'll conquer 1M milestone soon❤
Hi sir, I am getting error in launching chrome in intelij.... I am able to launch chrome browser but can't navigation/get url in that chrome? Plzz help me on it. I am used selenium 3.141.59 and chromedriver 122+ version Can i get ur no/ plzz tell me a sol on it.
Sir @@sdetpavan , What is the difference Between UAT test cases and QA test Cases. In One of my Interview, Interviewer Asked me this Question. I failed to answer this question
@@ayubansari2074 UAT is for USER ACCEPTANCE TEST Mostly done by client with specific test cases and in the UAT Environment But QA is done by testing team members and in the QA environment
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..
That's fantastic! My goal is to ensure that everyone benefits from the videos.
in u demy course any extra concept or same
A brilliant way of teaching.. nice examples broken down and explained perfectly.
Glad it was helpful!
the problem for multiple inheritance is explained so clear. Thank You sir.
I watched a lot of content on RUclips, but the way Sir explains is on another level and very easy to understand. Before watching this video, I was a bit confused about multiple inheritance, but now I feel very confident about the concept. Thank you, Sir
Waiting for Abstraction and Interfaces which is very important and confusing. Hope my confusion will clear today.
Excellent Sir ❤❤❤ thank you for such videos,now i am get better understanding of this topics ❤❤❤
Welcome
Thank you for the detailed explanation .
You are welcome!
Sir thanks for your videos, with the help these videos i got the job... thankyou so much sir😊
Congrats.
Superb explaination sir ... Thank you so much🙂
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 ❤
Thanks
Thanks to you i am done with manual testing, and i am right now into automation testing
Sir thank you from the bottom of my heart. Your video helped me a lot to get a job😢.you are god to me.🙏
It's my pleasure
best teacher for the basic to high about the java
Thanks
It's very easy to understand even beginers also Tq soo much sir 🎉🎉🎉🎉🎉🎉🎉🎉🎉
Welcome
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.
MIND BLOW JOB SIR
In every journey god send some mentors to help you. You are one of them for this journey. Thank you sir ❣
It's my pleasure
Thank you so much sir,Every time i am learning something new from your session..
It's my pleasure
Excellent Explanation Sir...
You're welcome!
Perfectly explained sir. Thank you so much.
Welcome
thank you sir ❤❤❤
Welcome
waiting for more videos on abstraction ,,interfaces ,files ,exception handling and also advanced java
*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.
The explanation just too good to miss out on
Thank you so much sir@sdet qa for providing the best content I am very excited to learn selenium also.. eagerly waiting
Devudu sir meeru, nenu ekkada ilanti explanation chudaledhu , thank you sir 🙏
Welcome
you explained it very well!
Glad it was helpful!
You are god for us
thank you
We need more people like u sir
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
Nice
Thanks
Thank you
Welcome
sir i have to cover this syallusbus fast so do you have any other resource , bcz i am in final semeter of my final year left with only 2.5 month and any how i have to find placement in Qa
Sir how to pass runtime values through notepad or command prompt
hi sir how to get pdf notes
Is main method is predefined or user defined
Hi sir can I learn only Manual testing and ETL testing without learning selenium?
could you please create a video on sonar qube for test automation
Hello,
Where can I get the notes for these classes?
Sir, But in Inheritance there are 5 right?
Single
Multi level
Hierarchy
Multiple
Hybrid also there right?
sir please make a video on upcasting and downcasting??? actually i have a doubt why and when to use upcasting and downcasting????
Hello sir, Can you please make video on Katalon Studio tutorial
Yes sir
Sir approx how many videos will be there in this course??
I don't understand what is thread. There are so many definitions available but not able to understand this concept
What is Thread in java
Hi sir do you provide training on java fullstack?
please i need your udemy link
sir i faced one of the interview question like this.. if in the parent class methods or variables are protected or private then can you inherit the methods or variables from parent .. can you explain this topic also sir.. will help for us..
As far as variables are concerned.
If parent's class variables are PRIVATE, even if you inherit the Parent Class in your Child Class. You will not have access to those variables.
If the parent class variables are PROTECTED, then you can have access to these variables in the same class, different class same package, derived class same package, derived class different package, but NOT to different class different package.
Quick question Sir -> Is this series only focusing on Java concepts ? or you are going to start complete Selenium things as well?
Please reply Sir
Selenium will be started after completion of java sessions.
Amazing, Thanks a lot, Hats off to you Sir@@sdetpavan.
Actually I've taken a 3 months of break to switch into automation as I have work exp. of 3 yrs in Tech Mahindra. I've joined a class but its not much effective but then I came across with your videos.
I've done Lambda expression, streams, collection series of yours & now sticking with this series.
I'm so glad that I'm blessed with you at this moment.
Hopefully you'll conquer 1M milestone soon❤
Please upload the vedios alternative days ..
Hi sir, I am getting error in launching chrome in intelij.... I am able to launch chrome browser but can't navigation/get url in that chrome? Plzz help me on it.
I am used selenium 3.141.59 and chromedriver 122+ version
Can i get ur no/ plzz tell me a sol on it.
Can you please share udemy link
Sir u also teach in Udemy
Yes.
Sir @@sdetpavan , What is the difference Between UAT test cases and QA test Cases. In One of my Interview, Interviewer Asked me this Question. I failed to answer this question
@@ayubansari2074 UAT is for USER ACCEPTANCE TEST Mostly done by client with specific test cases and in the UAT Environment
But QA is done by testing team members and in the QA environment
hi sir
Please provide training for java full stack . Did u used eclipse sir?
Sir you also teach in udemy
Already have Udemy course there check ✅