类与对象的创建
public class application {
public static void main(String[] args) {
student xm = new student();
student xy = new student();
xm.name ="xiaoming";
xm.age = 11;
System.out.println(xm.name);
System.out.println(xm.age);
xm.study(xm);
System.out.println(xy.name);
System.out.println(xy.age);
xy.study(xy);
}
}
//学生类
public class student {
String name;
int age;
public void study(student s1){
System.out.println(s1.name + "正在学习");
}
}
标签:name,xm,对象,创建,System,xy,student,out
From: https://www.cnblogs.com/sara0618/p/17926360.html