Exception in thread "main" java.lang.NoSuchMethodError: main
Hi,
I get the "Exception in thread "main" java.lang.NoSuchMethodError: main" while executing my code.
I have two packages. I am inheriting from a class from one of the packages. Here's the code:
package food;
public class Fruit{
protected void printFruit() {
System.out.println("aatukutti is too much to handle.");
}
public void main(String args[])
{
}
}
import food.Fruit;
class Apple extends Fruit{
public void main(String args[]) {
Apple ap= new Apple();
ap.printFruit();
}
}
The code compiles fine. And when I execute it,I get the java.lang.NoSuchMethodError: main. Could you please help me out?
Thanks,