This week's giveaways are in the MongoDB and Jobs Discussion forums. We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line! See this thread and this one for details.
expected o/p only it is displaynig ---------- Run ---------- Hello World! from StaticSub from StaticSub m2 from StaticSup ----------------------------- How it is possible....
Thanks a lot<br />Learn from yesterday, live for today, hope for tomorrow. The important thing is to not stop questioning
Ashley Waldrop
Greenhorn
Joined: Feb 27, 2006
Posts: 9
posted
0
StaticSub class is only redifining method "static void m1()" not overriding although it seems like that at first look
StaticSub obj=new StaticSub(); obj.m1(); Is same as StaticSub.m1();
so should print "from StaticSub"
sreedhar lak
Ranch Hand
Joined: Feb 26, 2006
Posts: 42
posted
0
Thank you, If i replace obj1.m1() and obj1.m2() with StaticSub.m1() StaticSub.m2() resp. It is giving compiletime error ,it is fine. But what i am trying to ask you is that difference and suppose if i want to test whether static methods are overriden or not what changes should i make in my code. thanks a lot
Ashley Waldrop
Greenhorn
Joined: Feb 27, 2006
Posts: 9
posted
0
You can try something like this in previous code to get a clear picture whats going on