标签:对象 ros color font class ring static oid mil
package com.review;
public class Phone {
private String color;
private int price;
private String brand;
public Phone() {
}
public Phone(String color, int price, String brand) {
this.color = color;
this.price = price;
this.brand = brand;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getBrand() {
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
}
========================================
public class P {
public static void main(String[] args) {
Phone phone = phone2();
System.out.println(phone.getPrice());
System.out.println(phone.getColor());
System.out.println(phone.getBrand());
}
public static Phone phone2() {
Phone one = new Phone();
one.setBrand("华为");
one.setColor("金色");
one.setPrice(8888);
return one;
}
}
标签:对象 ros color font class ring static oid mil
原文地址:https://www.cnblogs.com/xzwx668/p/12045986.html