封装
package com.tiedandan.oop.封装;
public class application {
public static void main(String[] args) {
student liming =new student();
liming.getName();
String b =liming.getName();
System.out.println(b);
liming.setName("黎明");
String a = liming.getName();
System.out.println(a);
//封装可起到一定的检验作用,可以过滤掉垃圾数据
liming.setAge(999);
System.out.println(liming.getAge());
}
}
package com.tiedandan.oop.封装;
public class application {
public static void main(String[] args) {
student liming =new student();
liming.getName();
String b =liming.getName();
System.out.println(b);
liming.setName("黎明");
String a = liming.getName();
System.out.println(a);
//封装可起到一定的检验作用,可以过滤掉垃圾数据
liming.setAge(999);
System.out.println(liming.getAge());
}
}