public class DemoPhone {
public static void main(String[] args) {
Phone p = new Phone("小米", 998);
System.out.println(p.getBrand());
System.out.println(p.getPrise());
p.setBrand("苹果");
p.setPrise(8388);
System.out.println(p.getBrand());
System.out.println(p.getPrise());
p.call();
p.sendMessage();
p.playGame();
}
}
public class Phone {
private String brand;
private int prise;
public Phone() {
}
public Phone(String brand, int prise) {
this.brand = brand;
this.prise = prise;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getBrand() {
return brand;
}
public void setPrise(int prise) {
this.prise = prise;
}
public int getPrise() {
return prise;
}
public void call() {
System.out.println("正在使用价格为998元的小米品牌的手机打电话....");
}
public void sendMessage() {
System.out.println("正在使用价格为998元的小米品牌的手机发短信....");
}
public void playGame() {
System.out.println("正在使用价格为998元的小米品牌的手机玩游戏....");
}
}