This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
Jim Jonides wrote:How did you get that errors? Can you fix problems that Mohamed mentioned and let us know if you are still getting the same errors?
I refined the code: I still get a warning kinda but the program compiles: here is the code:
ERROR:Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Cannot make a static reference to the non-static method y() from the type MystaticEx2
Joined: Oct 12, 2010
You can ignore the warning, Java allows you to call static method on an instance object. The error you got from the last line is as expected - you can not call instance method in a static method without using an instance object.