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
posted 7 years ago
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.