From 212633cf9c03f4270ae8b2903db3126c5f7ffca2 Mon Sep 17 00:00:00 2001 From: WangHe <2260378191@qq.com> Date: Wed, 18 Mar 2026 21:53:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=96=87=E4=BB=B6=E8=87=B3?= =?UTF-8?q?=20'w2'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- w2/Main.java | 8 ++++++++ w2/Student.java | 13 +++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 w2/Main.java create mode 100644 w2/Student.java diff --git a/w2/Main.java b/w2/Main.java new file mode 100644 index 0000000..e9cd080 --- /dev/null +++ b/w2/Main.java @@ -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(); + } +} diff --git a/w2/Student.java b/w2/Student.java new file mode 100644 index 0000000..1ee194d --- /dev/null +++ b/w2/Student.java @@ -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); + } +}