package testwork;
class ShiStudent {
//学生类的相关数据和方法的调用
String name="";
String sex="";
int age=0;
float score=0.0f;
//输出说话内容
public void speak(String inStr) {
System.out.println("自我介绍:我叫"+name+",");
}
//输出得分
public void grade(float inscore) {
System.out.println("Java考试得分"+inscore);
}
public class Student{
public static void main(String[]args) {
ShiStudent stu1=new ShiStudent();
stu1.name="倪爱学";
stu1.sex="男";
stu1.age=20;
stu1.score=91.5F;
stu1.speak("年龄"+stu1.age+"岁,");
stu1.grade(stu1.score);
ShiStudent stu2=new ShiStudent();
stu2.name="雍心误";
stu2.sex="女";
stu2.age=18;
stu2.score=95;
stu2.speak("年龄"+stu2.age+"岁,");
stu2.grade(stu2.score);
}
}
}