java初学者
静之深 2010-06-23 07:28:21
import java.awt.*;
import java.applet.*;
class dogs
{
public String Name;
public int Weight;
public int Height;
public void ShowDog(Graphics g,int x,int y)
{
g.drawString("Name:"+Name,x,y);
g.drawString("Weight:"+Weight,x,y+20);
g.drawString("Height:"+Height,x,y+40);
}
}
public class c4_2 extends Applet
{
public void paint(Graphics g)
{
dogs Dane;
Dane=new dogs();
dogs Setter=new dogs();
Dane.Name="Great Dane";
Dane.Weight=100;
Dane.Height=30;
Setter.Weight=20;
Setter.Height=30;
Setter.Name="Irish Setter";
Dane.ShowDog(g,25,25);
Dane.ShowDog(g,25,120);
}
}
javac之后:
D:\>javac c4_2.java
D:\>java c4_2
Error: Main method not found in class c4_2, please define the main method as:
public static void main(String[] args)
Exception in thread "main" java.lang.RuntimeException: Main method not found in
c4_2
at sun.launcher.LauncherHelper.signatureDiagnostic(LauncherHelper.java:2
14)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:202)
请各位大虾看看到底是怎么回事:
是不是我忘记安装什么东西了啊