Thanks,<BR>Ravi Kiran Choppalli
Thanks,<BR>Ravi Kiran Choppalli
"JavaRanch, where the deer and the Certified play" - David O'Meara
Jane Griscti
SCJP, Co-author Mike Meyers' Java 2 Certification Passport
Thanks,<BR>Ravi Kiran Choppalli
Originally posted by rchopp:
class Base{
int i = 99 ;
public void amethod(){
System.out.println("Base.amethod()") ;
}
Base(){
amethod() ;
}
}
public class RType extends Base {
int i = -1 ;
public static void main(String arg[]) {
Base b = new RType() ;
System.out.println(b.i) ;
//b.amethod() ;
}
public void amethod(){
System.out.println("RType.amethod()") ;
}
}
The output of the above code is :
RType.amethod()
99
How is the first RType.amethod() getting printed ?
Thanks,
Ravi.
Consider Paul's rocket mass heater. |