class Phone
{
//手机的名字
String name;
//手机的颜色
String color;
//手机的价格
int price;
//手机的打电话功能
public void call()
{
System.out.println("打电话");
}
//手机的发短信功能
public void sendMessage(String name)
{
System.out.println("给"+name+"发短信");
}
//手机具有打游戏的功能
public String playGame()
{
System.out.println("打dota");
return "你已经超神了";
}
}
class CellPhone
{
public static void main(String[]args)
{
//给初始化值
Phone c=new Phone();
c.name="vivo";
c.color="红色";
c.price=3800;
System.out.println(c.name+"====="+c.color+"========="+c.price);
c.call();
c.sendMessage("小明");
String s=c.playGame();
System.out.println(s);
}
}
|