码迷,mamicode.com
首页 > 其他好文 > 详细

水果类

时间:2016-03-08 09:24:38      阅读:117      评论:0      收藏:0      [点我收藏+]

标签:

 

package com.hanqi;

public class shuiGuo {
private String color;
private double price;
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
private double weight;
}


}
private double weight;
}

public class fruit {

public static void main(String[] args) {
shuiGuo apple=new shuiGuo();
apple.setColor("红色");
apple.setPrice(5.5);
apple.setWeight(10);
System.out.println(apple.getColor());
System.out.println(apple.getWeight());
System.out.println(apple.getPrice());

}

}

水果类

标签:

原文地址:http://www.cnblogs.com/lizhe313/p/5252704.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!