Java Program Error -
while learning book, came across java example. when compiled it, had no error. when ran , showed:
exception in thread "main" java.lang.nosuchmethoderror: main
since beginner in java, don't know is.
the program is:
import java.awt.*; import java.awt.event.*; class party { public void buildinvite(){ frame f = new frame(); label l = new label("party @ tim's"); button b = new button("you bet"); button c = new button("shoot me"); panel p = new panel(); p.add(l); } }
if still want see execution of code try version:
class party{ public void buildinvite(){ frame f = new frame(); label l = new label("party @ tim's"); button b = new button("you bet"); button c = new button("shoot me"); panel p = new panel(); p.add(l); p.add(b); p.add(c); f.add(p); f.setvisible(true); } public static void main(string[] args) { new party().buildinvite(); } }
Comments
Post a Comment