I've noticed that when I create an instance of the class I'm in (from within the psvm method), I get a compile error. However, if I create an instance (from within the psvm method) of ANOTHER class, it compiles fine. Is that always the case? I was thinking so, because you can't access the instance variables/methods of the class from within a static method of that class, but you can access instance variables/methods of another class from a static method in another class if you create an instance.
Originally posted by J Recker: I've noticed that when I create an instance of the class I'm in (from within the psvm method), I get a compile error...
I assume that "psvm" stands for "public static void main," right? If so, "main method" is a more common terminology.
There is no reason you shouldn't be able to create an instance of the class from its own main method. Can you post an example of this error?
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Aug 26, 2006
I must've gotten confused after hours of studying yesterday, because today all things work as they should. static variables can be accessed from a static method, and instance variables cannot be directly accessed from a static method.
thanks for replying. sorry to have wasted your time. back to studying...
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com