类和对象的创建
public static void main(String[] args) {
//类:抽象化,实例化
//类实例化会返回一个自己的对象
//student对象就是一个Student类的具体实例
Student xiaoming = new Student();
Student xh = new Student();
xiaoming.name = "小明";
xiaoming.age = 14;
System.out.println(xiaoming.name);
System.out.println(xiaoming.age);
xh.name = "小红";
xh.age = 14;
System.out.println(xh.name);
System.out.println(xh.age);
}
public class Student {标签:xh,name,对象,创建,System,Student,xiaoming,out From: https://www.cnblogs.com/huangjiangfei/p/17965700
//属性
String name;
int age;
//方法
public void study(){
System.out.println(this.name+"在学习");
}
}