In Inheritance if we are implementing Multi level inheritance
and all class having same name of variable and now i want to
access each class variable and how it is possible?
Answers were Sorted based on User's Feedback
Answer / megha
IF ClassC extends ClassB and ClassB extends ClassA
All Classes having "public int a " with different values,
then
ClassA objA = new ClassA();
ClassB objAB = new ClassB();
ClassC objAC = new ClassC();
System.out.println(objA.a);
System.out.println(objAB.a);
System.out.println(objAC.a);
will show each class variable individually
****************************O R *******************
make a method to return superclass variable using "super.a"
| Is This Answer Correct ? | 4 Yes | 0 No |
What is Yield() method when we r using this ? tell exactly
Hi buddy, well i got that there is always a default constructor with abstract class. OK. But why not with interface? Thanks in advance.
What is mean by UML? what is the use? where we are using?
What is aggregation and composition ?
Java.util.regex consists of which classes?
Describe the syntax of multiple inheritance? When do we use such an inheritance?
What is Gang of four design patterns
What is the difference between the direct buffer and non-direct buffer in java?
I need to know about complete topic in java's collections i with an examples
Differentiate between a constructor and a method? Can we mark constructors final?
Name the packages in JDK?
Why arraylist is used in java?