This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes how to call parent class data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "how to call parent class data" Watch "how to call parent class data" New topic
Author

how to call parent class data

Inder Kumar Rathore
Ranch Hand

Joined: Apr 14, 2010
Posts: 41
here i have a code...


class A
{
int i=90;
}

class B extends A
{
int i=100;
}


class C extends B
{
int i=200;
void foo()
{
System.out.println(this.i);// C
System.out.println(super.i);// b
System.out.println(i);// now how i call i of A
}
}


Thanks

Living is easy with your eyes closed.....
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18507
    
  40

Try...



Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Inder Kumar Rathore
Ranch Hand

Joined: Apr 14, 2010
Posts: 41
thanks....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to call parent class data
 
Similar Threads
How to call "super.super.methodName()"
Decison between overriding methods & arithmetic prmotable overloaded methods
Accessing the base class methods in child class.
Need "super" keyword understanding
JavaRanch #19