wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How to deal with these problems in SCJP2? 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 "How to deal with these problems in SCJP2?" Watch "How to deal with these problems in SCJP2?" New topic
Author

How to deal with these problems in SCJP2?

Jason
Ranch Hand

Joined: Dec 06, 2000
Posts: 35
I still feel blurry about the following two concepts:
SCJPs experts plz give me some tips from exam's point of view:
1. A static method can/cannot be overriden? what is the difference between overriding and hiding? (I just don't get it from reading JLS).
2. An inner class means a nonstatic inner class/static and nonstatic both?
Thanx in Advance.
Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
1) Overriding implies run-time polymorphism. Calls to <CODE>static</CODE> methods are resolved at compile time so there is no real run-time polymorphism. If you write a static method in a subclass with the same signature and return type as one in the superclass, you are hiding the superclass method because the one in the subclass is now resolved at compile time.
2) <CODE>static</CODE> "inner" classes are really nested classes, not inner. Although Sun has not been consistent with the language used.


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
vaibhav deshmukh
Greenhorn

Joined: Jun 28, 2000
Posts: 7
i agree with tony.many a times the language used is ambiguous.one can't be sure what exactly the statement means.i think such ambiguity shouldn't be there in such exams.
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
1. Method Overriding: Methods can always be overrided provided over-riding method and over-riden method , both should be either static or both of them be non-static . We cannot mix them.

Ankur Gupta
Ranch Hand

Joined: Jun 13, 2000
Posts: 66
Jason, have alook at Carl's notes :
http://www.crosswinds.net/~cdesboro/
I think his explanation is pretty neat.
Ankur
[This message has been edited by Ankur (edited July 07, 2000).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to deal with these problems in SCJP2?
 
Similar Threads
Quick question: why can't an inner class have static members?
Inner Class question Bill Brodgen
When are inner class objects garbage collected
Inner classes.
Static Nested Classes