java 程序的小问题

来源:百度知道 编辑:UC知道 时间:2024/05/14 04:50:20
public class Student
{
public String name;
public char sex;
public String birthday;
private int compScore,engScore;
提示找不到符号---> public Student (String str1,char ch,string str2)
{
name=str1;
sex=ch;
birthday=str2;
}
public void setcompScore(int data)
{
compScore=data;
}
public int getcompScore()
{
return compScore;
}
public void setengScore(int data)
{
engScore=data;
}
public int getengScore()
{
return engScore;
}
public double getAverScore()
{
return (compScore+engScore)/2;
}
public int getMaxScore()
{
int max;
if (compScore>engScore)
max=compScore;
else
max=engScore;
return max;
}
public String toString()
{
return"

第三个参数类型,你写的string,应该大写String

你的程序是application还是applet程序??
main 主函数都没,applet包也没导入,
而且,感觉这程序很乱,
这是个无法运行的类,

确实很乱……
程序不难……
第三个参数类型,你写的string,应该大写String
加个main
public static void main(String args[])
{
Student stu = new Student();
}
再调用好函数基本可以运行了