主题:java运行错误,请高手指点!
Exception in thread "main" java.lang.NoSuchMethodError:main
运行后出现上面的错误!
代码如下:
import java.awt.*;
import java.applet.*;
import java.util.*;
public class BorderLayoutDemo extends Applet
{
public void init()
{
setLayout(new BorderLayout());
add(new Button("This is arross the top"),
BorderLayout.NORTH);
add(new Label("The message is on the bottom"),
BorderLayout.SOUTH);
add(new Button("Left"),BorderLayout.WEST);
add(new Button("Right"),BorderLayout.EAST);
String message="This is the message in the Center!";
add(new TextArea(message),BorderLayout.CENTER);
}
}
运行后出现上面的错误!
代码如下:
import java.awt.*;
import java.applet.*;
import java.util.*;
public class BorderLayoutDemo extends Applet
{
public void init()
{
setLayout(new BorderLayout());
add(new Button("This is arross the top"),
BorderLayout.NORTH);
add(new Label("The message is on the bottom"),
BorderLayout.SOUTH);
add(new Button("Left"),BorderLayout.WEST);
add(new Button("Right"),BorderLayout.EAST);
String message="This is the message in the Center!";
add(new TextArea(message),BorderLayout.CENTER);
}
}