File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

null

 
Raju Champaklal
Ranch Hand
Posts: 521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


why does this not give any compile error? the questions was from whizlabs....i created my own code to test the concept
 
Ankit Garg
Sheriff
Posts: 9497
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rajiv Chopra
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic