(1)定义描述学生的类Student,有一个构造方法对属性 进行初始化,一个outPut方法用于输出学生的信息。 (2)定义主类,创建两个Student类的对象,测试其功能。 public class Student {Stri
public class Student { String name; int age; char gender; Student(String name,int age,char gender){ this.name=name; this.age=age; this.gender=gender; } void output(){ System.out.print(this.name +" "+this.age+" "+this.gender); } } public class text3 { public static void main(String[] args) { Student myStudent1=new Student("刘妍", 21, 'F'); myStudent1.output(); System.out.println(); Student myStudent2=new Student("jack", 20, 'M'); myStudent2.output(); } }