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 |
where exactly collections are usefull in realtime
What is the structure of java?
What is a method header?
What is the difference between the final method and abstract method?
What is the maximum size of hashmap in java?
How many bits is a char?
What is append function?
How do u pass data from one jsp to another jsp?
What's the base class of all exception classes?
What are jee technologies?
What is the difference between Trusted and Untrusted Applet ?
What is meant by Servelet? What are the parameters of service method?