I keep getting the following error when I try to see if my script works Exception in thread "main" java.lang.NoSuchMethodError: main
Here is the script :
class Pizza {
int toppings;
int extras;
Pizza() {
toppings=1;
extras=3;
}
Pizza(int p, int c) {
toppings=p;
extras=c;
}
Pizza all=new Pizza(10,11);
Pizza none=new Pizza();
}
I have no problem doing a javac Pizza.java. Its just when I do a java Pizza that the error appears. I looked at the previous thread that had a similar error, but the only thing I had in common with the other person's ters was when I did a java -cp .Pizza which did nothing at all, but give me argument types.
I'm quite new to Java and have only just started. If anyone can give me a hand, it would be greatly appreciated.
Thanks in advance,
Z.
Here is the script :
class Pizza {
int toppings;
int extras;
Pizza() {
toppings=1;
extras=3;
}
Pizza(int p, int c) {
toppings=p;
extras=c;
}
Pizza all=new Pizza(10,11);
Pizza none=new Pizza();
}
I have no problem doing a javac Pizza.java. Its just when I do a java Pizza that the error appears. I looked at the previous thread that had a similar error, but the only thing I had in common with the other person's ters was when I did a java -cp .Pizza which did nothing at all, but give me argument types.
I'm quite new to Java and have only just started. If anyone can give me a hand, it would be greatly appreciated.
Thanks in advance,
Z.