This discussion is archived
10 Replies Latest reply: Mar 19, 2008 6:26 AM by 807601 RSS

java.lang.NoSuchMethodError: main

807601 Newbie
Currently Being Moderated
when I try to run this code, I get the following error:

java.lang.NoSuchMethodError: main
Exception in thread "main"
Java Result: 1

Can somebody tell me why that is?

Thanks.
class Beverage {
    Beverage() { System.out.print("beverage "); }
    public static void main(String[] args) {
        int x = 3;
        assert (x==3): "yahooooo";
        Beverage b = new Beverage();
    }
}

class Beer extends Beverage {
    
    public Beer(int x) {
        this();
        System.out.print("beer1 ");
    }
    public Beer() { System.out.print("beer2 "); }
    
    
}