aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Class" Watch "Class" New topic
Author

Class

Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
Please see the ollowing code
/CODE
public class C {
int i =1;
public void foo() {
System.out.println("C foo()");
}
public static void main(String args[])
{
new D().run(new D());
}
}
class D extends C {
int i =2;
public void foo() {
System.out.println("D foo()");
}
public void run(C ac)
{
System.out.println(ac.i);
foo();
}
}
the result is 1 D foo().
Can somebode explain me how is it 1.I thought it should be 2 D foo().

[This message has been edited by Sunita Vontel (edited August 31, 2000).]
[This message has been edited by Sunita Vontel (edited August 31, 2000).]
Sandeep Potnis
Ranch Hand

Joined: Aug 18, 2000
Posts: 39
Take a look at
this thread and this one too
Sunita Vontel
Ranch Hand

Joined: Aug 28, 2000
Posts: 72
Thanks Sandeep
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class
 
Similar Threads
about gc()
inner class
shift
Barry Boone #29
A question for Beginners - 3