package forken;
/**
- 学生类
- 属性:学号 姓名 年龄 。。。。
- 方法:学习 吃饭 睡觉。。。。
- @author Administrator
*/
public class user {
int sid;
String name;
int age;
public void study(){
System.out.println("学习");
}
public void eat(){
System.out.println("吃饭'");}
public void sleep(){
System.out.println("睡觉");
}
}
package forken;
public class userceshi {
public static void main(String[] args) {
user s1=new user();
s1.sid=100;
s1.name="tom";
s1.age=20;
s1.eat();
s1.sleep();
s1.study();
System.out.println(s1.sid);
System.out.println(s1.name);
System.out.println(s1.age);
user s2=new user();
s2.sid=100;
s2.name="tom";
s2.age=20;
s2.eat();
s2.sleep();
s2.study();
System.out.println(s2.sid);
System.out.println(s2.name);
System.out.println(s2.age);
}