You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
746 B
24 lines
746 B
public class Student {
|
|
public int ID;
|
|
public String name;
|
|
public int age;
|
|
public String major;
|
|
public Student(int ID,String name,int age,String major){
|
|
this.ID=ID;
|
|
this.name=name;
|
|
this.age=age;
|
|
this.major=major;
|
|
}
|
|
public void info(){
|
|
System.out.println("学生学号:"+ID);
|
|
System.out.println("学生姓名:"+name);
|
|
System.out.println("学生年龄:"+age);
|
|
System.out.println("学生专业:"+major);
|
|
}
|
|
public static void main (String[] args){
|
|
Student mary=new Student(20220933,"Mary_Jane",22,"computer_science");
|
|
mary.info();
|
|
Student John=new Student(20210288,"John Shark",23,"data science");
|
|
John.info();
|
|
}
|
|
}
|
|
|