代码拉取完成,页面将自动刷新
package test_01;
class Phone {
private String brand;
private double price;
public Phone() {
}
public Phone(String brand, double price){
this.brand=brand;
this.price=price;
}
public String getBrand()
{
return brand;
}
public void setBrand(String brand) {
this.brand = brand;
}
public double getPrice()
{
return price;
}
public void setPrice(double price) {
this.price = price;
}
public void call()
{
System.out.println("正在使用价格为"+price+"元的"+brand+"手机打电话");
}
public void listenMusic()
{
System.out.println("正在使用价格为"+price+"元的"+brand+"手机听歌");
}
}
public class test_04_28 {
public static void main(String[] args) {
Phone ph1=new Phone();
ph1.setBrand("华为");
ph1.setPrice(998);
ph1.call();
Phone ph2=new Phone("小米",998);
ph2.listenMusic();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。