set和get这两个词的表面意思,set是设置的意思,而get是获取的意思,顾名思义,这两个方法是对数据进行设置和获取用的,一般来说set和get方法都是对私有域变量进行操作的,因为私有域的变量其他类不能访问,所以需要借助get和set方法用于访问私有域变量。
import java .util.Arrays;
public class More {
public static void main(String[] args) {
Student zs = new Student();
zs.setName(“zhangsan”);
zs.setAge(25);
System.out.println(zs.getName());
System.out.println(zs.getAge());
}
}
class Student{ //get/set结构
private String name;
private int age;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
You actually mentioned it well.
purchase college papers best write my paper
Whoa loads of valuable material.
best freelance writer websites length of dissertation
You revealed that perfectly.
dissertation literature review services dissertation coach reviews
You actually stated it perfectly.
pay someone to write an essay for you
Thanks a lot, Plenty of content!
essay writer write my paper for me please
Perfectly voiced indeed. !
can anyone write an essay for me write my research essay
Cheers! Useful stuff!
casino online login soaring eagle online casino app
Nicely put, Appreciate it!
write a literature review for me essay writer for cheap