File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes non-static variable this cannot be referenced from a static context 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 "non-static variable this cannot be referenced from a static context" Watch "non-static variable this cannot be referenced from a static context" New topic
Author

non-static variable this cannot be referenced from a static context

Timothy Toe
Ranch Hand

Joined: Oct 19, 2002
Posts: 156

Why ?
Keen Chen
Ranch Hand

Joined: Nov 12, 2002
Posts: 47
hi
if u wanna a inner class (not static)object, u do this: new.Outer().new Inner(). must need a Outter class object reference first. right?
but , in a static method ,not exist a reference(unless u NEW it).
because static method is pertain a class,


SCJP 1.4 100% @ Peking, China <br />~~~~~~~~~~~~~~~~~~~~~<br />但使龙城飞将在, 不教胡马度阴山!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: non-static variable this cannot be referenced from a static context