the method that ferform to change the parameterlist of class object are called mutators. Programmer often give them names that begin with set. Mutator method are void methods; they change am object's state but not return a value.
调试欢乐多
{
String name, city;
University(String name, String city)
{
this.name = name;
this.city = city;
}
} class UniversityCreate
{
public static void main(String args[])
{
University u = new University("北京大学", "北京");
System.out.println("大学:" + u.name + " 城市:" + u.city);
}
} new语句中类名后的参数是传给构造函数的。