public class Student {
private String name;
private String number;
private int score;
public Student() {
}
public Student(String name, String number, int score) {
super();
this.name = name;
this.number = number;
this.score = score;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public String toString() {
return "Name: " + name
+ ",Number: " + number
+ ",Score : " + score;
}
//调用方法
public static void main(String[] args) {
Student s = new Student("Jack","123456",98);
System.out.println(s.toString());
}
}
运行结果:
Name: Jack,Number: 123456,Score : 98
public class student{
String id;
String name;
String record;
student(String id,String name,String record){
this.id=id;
this.name=name;
this.record=record;
}
public void show(){
System.out.println("学号:"+id+"/n 姓名:"+name+"/n 成绩"+record)
}
}
帮做10微信红包就可以,需要回复
public class Student {
private String xuehao;
private String name;
private int score;
public Student(){}
public Student(String xuehao,String name,int score)
{
this.name=name;
this.score=score;
this.xuehao=xuehao;
}
public void speak()
{
System.out.println("学号:"+xuehao+",名字:"+name+",分数:"+score);
}
}
public class Test {
public static void main(String[] args) {
Student s = new Student("322088388", "小米",90);
s.speak();
}
}