c# break和continue
阿新 • • 發佈:2022-05-11
package base.oop.demo01.demo02;
//學生類
public class Student {
//屬性:欄位
String name;
int age;
//方法
public void study(){
System.out.println(this.name+"在學習");
}
}
package base.oop.demo01.demo02;
//一個專案應該只存在一個main方法
public class Application {
public static void main(String[] args) {
//類:抽象的,需要例項化
//類例項化後會返回一個自己的物件
//student物件就是一個Student類的具體例項!
Student student = new Student();
Student xiaoming= new Student();
Student xiaohong = new Student();
xiaoming.name="小明";
xiaoming.age=20;
xiaohong.name="小紅";
xiaohong.age=18;
System.out.println(xiaoming.name);
System.out.println(xiaoming.age);
System.out.println(xiaohong.name);
System.out.println(xiaohong.age);
}
}