wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Sub Class and super class 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 » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Sub Class and super class" Watch "Sub Class and super class" New topic
Author

Sub Class and super class

sonir shah
Ranch Hand

Joined: Nov 01, 2001
Posts: 435

Answer :
Show method is Test class
Show method in Q2 class
Show method in Test class
Show method in Q2 class
But in the main, we say : t=q and then t.show(), which means that it should print "Show method in Q2 class." and again in the second case,
we say q=(Q2)t, and then q.show(), which should print "Show method in TestClass."..
Where am I worng??
Sonir
bill williams
Ranch Hand

Joined: Jan 15, 2002
Posts: 94
because it is not 'overridden'.
<quote>
a subclass cannot override methods that are declared static in the superclass. In other words, a subclass cannot override a class method. A subclass can hide a static method in the superclass by declaring a static method in the subclass with the same signature as the static method in the superclass.
</quote>


Yet Another SCJP2
bill williams
Ranch Hand

Joined: Jan 15, 2002
Posts: 94
instance variables are not 'overridden' either, just in case u might not know
 
wood burning stoves
 
subject: Sub Class and super class
 
Similar Threads
Majji exam1 Qno2
plz help
plz help
Tips,oneliner Just before the SCJP Exam
Question