JAVA-学生类的定义和使用
package com.itheima;
/*
学生测试类
*/
public class StudentDemo {
public static void main(String[] args) {
// 创建对象
student s = new student();
//给成员变量复制
s.name="林青霞";
s.age=30;
System.out.println(s.name+","+s.age);
//调用成员方法
s.study();
s.doHomework();
}
}
执行结果
林青霞,30
好好学习
多做练习
Process finished with exit code 0