下面的个小程序在eclipse里面怎么运行啊,说清楚点谢谢。初学者,不好意思啊。 5
因为没有main所以不能直接运行了,而用ranas,ranas里面有一个灰色的(noneapplicable)importjava.awt.*;importjava.ap...
因为没有main所以不能直接运行了,而用ran as ,ran as里面有一个灰色的(none applicable)
import java.awt.*;
import java.applet.*;
class student
{
public String Name;
public int age=16;
public int score=0;
public void ShowStudent(Graphics g,int x,int y)
{
g.drawString("Name:"+Name,x, y);
g.drawString("age:"+age, x, y+20);
g.drawString("score:"+score, x, y+40);
}
}
public class use
{
public void studentAttributes(student s,String Name,int age,int score)
{s.Name=Name;s.age=age;s.score=score;}
public void paint(Graphics g)
{
student st1=new student();
student st2=new student();
studentAttributes(st1,"zhang",23,81);
studentAttributes(st2,"li",24,90);
st1.ShowStudent(g,25,25);
st2.ShowStudent(g,25,120);
}
}
gsbb2004说的还是不行啊
选择用ran as applet 时,出来一个错误:selection does not contain an applet. 展开
import java.awt.*;
import java.applet.*;
class student
{
public String Name;
public int age=16;
public int score=0;
public void ShowStudent(Graphics g,int x,int y)
{
g.drawString("Name:"+Name,x, y);
g.drawString("age:"+age, x, y+20);
g.drawString("score:"+score, x, y+40);
}
}
public class use
{
public void studentAttributes(student s,String Name,int age,int score)
{s.Name=Name;s.age=age;s.score=score;}
public void paint(Graphics g)
{
student st1=new student();
student st2=new student();
studentAttributes(st1,"zhang",23,81);
studentAttributes(st2,"li",24,90);
st1.ShowStudent(g,25,25);
st2.ShowStudent(g,25,120);
}
}
gsbb2004说的还是不行啊
选择用ran as applet 时,出来一个错误:selection does not contain an applet. 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询