Introduction:
There are many questions as How to fix java.lang.NoSuchMethodError on SO.
As I can see, the simplest way to get this error, is to make a class
class MyClass {} // no methods at all, for instance
without properly defined main method, compile it and run:
java MyClass
Exception emerges:
Exception in thread "main" java.lang.NoSuchMethodError: main
But this example is too simple.
The question:
Could anyone provide a simple code, which
- Consists of two, maximum three classes (if you can show that more classes are needed - then you are welcome);
- Contains properly defined main method;
- Running of the class with that main method, leads to exception with java.lang.NoSuchMethodError.