public class Student
{
int number;
String banji;
char sex;
int age;
public int getNumber(int n1)
{
number = n1;
return number;
}
public char getSex(char s1)
{
sex = s1;
return sex;
}
public String getName(String name)
{
return name;
}
public int getAge(int a1)
{
age = a1;
return age;
}
public void changeAge(int a1)
{
age = age - a1;
}
public void toString1()
{
System.out.println("number="+number);
System.out.println("sex="+sex);
System.out.println("banji="+banji);
System.out.println("age="+age);
}
public static void main(String[] args)
{
Student s1 = new Student();
s1.getNumber=(1234567890);//int
s1.getSex=(*男*); //char
s1.getName=("AAA"); //string
s1.getAge=(20); //int
s1.changeAge=(30); //int
s1.toString1();
}
}
这个是我写的代码,编译的时候总是提示这个
求大神解答下
{
int number;
String banji;
char sex;
int age;
public int getNumber(int n1)
{
number = n1;
return number;
}
public char getSex(char s1)
{
sex = s1;
return sex;
}
public String getName(String name)
{
return name;
}
public int getAge(int a1)
{
age = a1;
return age;
}
public void changeAge(int a1)
{
age = age - a1;
}
public void toString1()
{
System.out.println("number="+number);
System.out.println("sex="+sex);
System.out.println("banji="+banji);
System.out.println("age="+age);
}
public static void main(String[] args)
{
Student s1 = new Student();
s1.getNumber=(1234567890);//int
s1.getSex=(*男*); //char
s1.getName=("AAA"); //string
s1.getAge=(20); //int
s1.changeAge=(30); //int
s1.toString1();
}
}
这个是我写的代码,编译的时候总是提示这个
求大神解答下