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

Static method - Non static variables

 
aakash bhatt
Ranch Hand
Posts: 182
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is there any way to access Non-Static variables/methods from a static methd
Regards,
aakash
 
Michael Morris
Ranch Hand
Posts: 3451
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create an object of the class and get them thru the instance. You have to remember that the reason you can't access instance variables and methods from a static context is that static methods are not polymorphic which means that the compiler links the method at compile time, not runtime like. So the compiler has no way of knowing what instance (if any) to use.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic