郁闷 写了好几题都这样 高手教教我
程序代码:
class student{
private String name;
private String school;
private String age;
public void setname(String name){
this.name = name;}
public void setschool(String school){
this.school = school;}
public void setage(String name){
this.school = school;}
public void seti(int i){
this.i = i;}
public String getname(){
return name;}
public String getschool(){
return school;
}
public String getage(){
return age;
}
public void said(String name,String school, String age){
System.out.println("我的名字叫"+name+"今年"+age+"岁");
}
public class test{
student a = new student();
a.said(mark,fjnu,five);
}
}
----------------解决方案--------------------------------------------------------
都是需要标识符
----------------解决方案--------------------------------------------------------
程序代码:
class Student{
private String name;
private String school;
private String age;
public void setName(String name){
this.name = name;}
public void setSchool(String school){
this.school = school;}
public void setAge(String name){
this.school = school;}
public String getName(){
return name;}
public String getSchool(){
return school;
}
public String getAge(){
return age;
}
public void said(String name,String school, String age){
System.out.println("我的名字叫"+name+"今年"+age+"岁");
}
}
public class Test{
public static void main(String[] args)
{
Student a = new Student();
a.said("mark","fjnu","five");
}
}
----------------解决方案--------------------------------------------------------
你的程序没有main, 如何运行呢
----------------解决方案--------------------------------------------------------
回复 4楼 lampeter123
介个介个……
----------------解决方案--------------------------------------------------------
回复 4楼 lampeter123
书看了 刚刚开始联系自己写 经常会忘记
----------------解决方案--------------------------------------------------------
那个也得养成良好的编程风格,格式的注意下!!
----------------解决方案--------------------------------------------------------
提示: 作者被禁止或删除 内容自动屏蔽