1.what is inheritance?
1.Multiple inheritance( java doesn't support multiple inheritance).
2.Multilevel inheritance.
3.How Inheritance can be implemented in java?
2.implements
1.For Code Re usability.
2.For Method Overriding.
5.what is syntax of inheritance?
public class subclass extends superclass{
//all methods and variables declare here
}
6.what is multilevel inheritance?
- inheritance is one of the oops concepts in java.inheritance is concept of getting properties of one class object to another class object.
- Inheritance represents the IS-A relationship,also known as parent-child relationship.
1.Multiple inheritance( java doesn't support multiple inheritance).
2.Multilevel inheritance.
3.How Inheritance can be implemented in java?
- Inheritance can be implemented in JAVA using below two keywords:
2.implements
- extends is used for developing inheritance between two classes and two interfaces.
- implements keyword is used to developed inheritance between interface and class.
1.For Code Re usability.
2.For Method Overriding.
5.what is syntax of inheritance?
public class subclass extends superclass{
//all methods and variables declare here
}
6.what is multilevel inheritance?
- Getting the properties from one class object to another class object level wise with different priorities.
6.what is Multiple inheritance?why Java Doesn't Support multiple Inheritance.
- The concept of Getting the properties from multiple class objects to sub class object with same priorities is known as multiple inheritance.
- In multiple inheritance there is every chance of multiple properties of multiple objects with the same name available to the sub class object with same priorities leads for the ambiguity. also known as diamond problem. one class extending two super classes.
- Because of multiple inheritance there is chance of the root object getting created more than once.
- Always the root object i.e object of object class hast to be created only once.
- Because of above mentioned reasons multiple inheritance would not be supported by java.
- Thus in java a class can not extend more than one class simultaneously. At most a class can extend only one class.
8.How do you implement multiple inheritance in java?
interface A{
}
interface B{
}
class C implements A,B{
}
9.Can a class extend itself?
10.What happens if super class and sub class having same field name?
- Using interfaces java can support multiple inheritance concept in java. in java can not extend more than one classes, but a class can implement more than one interfaces.
interface A{
}
interface B{
}
class C implements A,B{
}
9.Can a class extend itself?
- No,A class can't extend itself.
10.What happens if super class and sub class having same field name?
- Super class field will be hidden in the sub class. You can access hidden super class field in sub class using super keyword.
Thank you for sharing such a valuable information
ReplyDeletebest sap simple finance online training institute in hyderabad
Awesome blog. It was very informative. I would like to appreciate you. Keep updated like this best selenium training institute in hyderabad
ReplyDeleteThank you for your post. This is excellent information. It is amazing and wonderful to visit your site.
ReplyDeleteDot Net Course in Chennai
Best Selenium Training Institute in Chennai
Software Testing Training Institute in Chennai | Testing Courses in Chennai
Java Training Institute in Chennai | Core Java Training in Chennai | Java Course and Certification
PHP Course in Chennai
ReplyDeleteGet the most advanced RPA Course by RPA Professional expert. Just attend a FREE Demo session about how the RPA Tools get work.
For further details call us @ 9884412301 | 9600112302
RPA training in chennai | UiPath training in chennai
This comment has been removed by the author.
ReplyDelete
ReplyDeleteIt was great experience after reading this. thanks for sharing such good stuff with us.
Core Java Course in Delhi
selenium online trainings
ReplyDeleteselenium online trainings from India