private String name;
Private int the age;
Stu () {
}
Public Stu (String name, int age) {
this.name=name;
this.age=age;
}
Public String getName () {
return name;
}
Public void elegantly-named setName (String name) {
this.name=name;
}
Public int getAge () {
return age;
}
Public void setAge (int a) {
Age=a;
}
Public void the speak () {
System. The out. Println (" my name is: "+ name +" this year "+ age);
}
}
The class TestStu {
Public static void main (String [] args) {
Stu Stu=new Stu (" Fan Ze ", "18");
Stu. Speak ();
}
}
CodePudding user response:
Stu Stu=new Stu (" Fan Ze ", "18");Age "18" to remove the quotes, receiving the parameter type is int
CodePudding user response:
At least get a vs code, such mistakes when writing should reflect out,There is no matching constructor: