package com.zws06;
public class Phone {
private String brand;
private int price;
private String color;
public Phone() {
}
public Phone(String brand,int price,String color) {
this.brand = brand;
this.price = price;
this.color = color;
}
public void setBrand(String brand) {
this.brand = brand;
}
public String getBrand() {
return brand;
}
public void setPrice(int price) {
this.price = price;
}
public int getPrice() {
return price;
}
public void setColor(String color) {
this.color = color;
}
public String getColor() {
return color;
}
}
package com.zws06;
public class PhoneDemo {
public static void main(String[] args) {
Phone ph1 = new Phone();
ph1.setBrand("iphone");
ph1.setPrice(9999);
ph1.setColor("土豪金");
System.out.println(ph1.getBrand()+","+ph1.getPrice()+","+ph1.getColor());
Phone ph2 = new Phone("oppo",8999,"白色");
System.out.println(ph2.getBrand()+","+ph2.getPrice()+","+ph2.getColor());
}
}