求大神指教,用Java编写程序

2025-04-03 16:22:14
推荐回答(1个)
回答1:

class Students{
public String name;
public void chooseClass(){
System.out..println("学生选课");
}
public void class(){
System.out..println("学生上课");
}
}
class Remove{
public int number;
public void search(){
System.out.println("查找学生");
}
}
public class Test{
public static void main(String[] args){
Students students = new Students();
Class class = new Class();
students.chooseClass();
students.class();
class.search();
}
}
感觉你们应该没有学封装我就没有写那些全用public的!