package com.oop.demo01;
public class Student {
//属性
String name;
int age;
//方法
public void study(){
System.out.println(this.name + "学生在学习");
}
//无参构造
public Student() {
}
//有参构造
public Student(String name, int age) {
this.name = name;
this.age = age;
}
}
package com.oop.demo01;
public class Application {
public static void main(String[] args) {
Student wu = new Student();
wu.name = "wu";
wu.study();
Student liu = new Student("liu",5);
liu.study();
}
}