标题:需要标识符
取消只看楼主
kurin
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2016-10-1
结帖率:100%
已结贴  问题点数:2 回复次数:0 
需要标识符
/*实训2:编写一个手机类,具有如下功能。
手机事物:
        属性:品牌,价格,颜色...
        行为:打电话,发短信,玩游戏...

然后编写一个测试类去测试手机的功能。*/

class phone{  
  String brand ;//brand 牌子
  String   price ;
  String   color;

public void call(){
     System.out.println("打电话。");
}
public void messages(){
     System.out.println("发短信。");
}
public void games(){
     System.out.println("玩游戏。");
}
}

public class Test0602{
     pubilc static void main(String[] args){
     phone huawei=new phone();
     huawei.brand="华为p10";
     huawei.price="4000元";
     huawei.color="gold";
System.out.println(huawei.brand);
System.out.println(huawei.price);
System.out.println(huawei.color);
     huawei.call();
}


[此贴子已经被作者于2017-3-16 21:59编辑过]

搜索更多相关主题的帖子: public games color price 玩游戏 
2017-03-16 18:49



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-475154-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016467 second(s), 9 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved