Meaningless Drivel is fun!*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes null 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 "null" Watch "null" New topic
Author

null

Raju Champaklal
Ranch Hand

Joined: Dec 10, 2009
Posts: 521


why does this not give any compile error? the questions was from whizlabs....i created my own code to test the concept


scjp 1.6 91%, preparing for scmad
"Time to get MAD now.. we will get even later"....by someone unknown
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

Raju, UseAMeaningfulSubjectLine for your topics. Just writing "null" or similar doesn't tell much about the topic. You've been reminded about this many times.

Try this simpler code

Basically, when you call a static method or access a static field on an instance of the class, the compiler replaces the instance with the type of the instance. So your code would actually look to the JVM like this


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
Rajiv Chopra
Ranch Hand

Joined: Dec 19, 2008
Posts: 62
Ankit Garg wrote: when you call a static method or access a static field on an instance of the class, the compiler replaces the instance with the type of the instance.


Thanks Ankit..


Rajeev Kumar
SCJP 6.0 Certified 96%
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: null
 
Similar Threads
final instance variable
overloading doubt
NullPointerException
final arguments
can "null" be considered as an object?