This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes method dynamic loading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "method dynamic loading" Watch "method dynamic loading" New topic
Author

method dynamic loading

zhewen
Ranch Hand

Joined: Jul 18, 2000
Posts: 35
i have also the problem like the one's guoru posted.
another exp:
class Question { String s="Outer";
public static void main(String[] args){
S2 s2=new S2();
s2.display();}}
class S1 {String s="S1";
void display(){
System.out.println(s);}}
class S2 extends S1{
String s="s2";}
the class S2 has the display() method, inherated from S1.
wenn in main()call new S2(), is the String s="s2" also initiated?
Java initiat the variable in compile time, what is realy happen?
anyone please give some different example?

thanks

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: method dynamic loading
 
Similar Threads
another Question.
Inheritance ....
HOW VARIABLES ARE DECIDED
Inheritence
Why doesn't the subclass variable hide it?