类(初学)
1属性
2行为
3类是抽象,对象是具体
4一个标准类有四个内容:private 修饰;getter,setter方法;无参构造;全参构造。
package day01;
public class Student {
private String name;
private int age;
public String getName() {
return name;
}
public int getAge() {
return age;
}
public void setName(String name) {
this.name = name;
}
public void setAge(int age) {
this.age = age;
}
public void hi(String name,int age){
System.out.println("我叫"+name+"今年"+age);
}
}
package day01;
//import day01.Student
public class Case03 {
public static void main(String[] args) {
Student stu1=new Student();
stu1.setName("Lucken");
stu1.setAge(18);
stu1.hi("Lucken",18);
}
}