2 changed files with 21 additions and 0 deletions
@ -0,0 +1,8 @@ |
|||||
|
public class Main{ |
||||
|
public static void main(String[] args){ |
||||
|
Student s1=new Student(20242111,"小明",99.5f); |
||||
|
Student s2=new Student(20252100,"小亮",88.5f); |
||||
|
s1.study(); |
||||
|
s2.study(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
public class Student { |
||||
|
int studentID; |
||||
|
String name; |
||||
|
float score; |
||||
|
public Student(int studentID,String name,float score){ |
||||
|
this.name=name; |
||||
|
this.studentID=studentID; |
||||
|
this.score=score; |
||||
|
} |
||||
|
public void study(){ |
||||
|
System.out.println(name+studentID+score); |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue