package MianXiangDuiXiang;
/**
* 成员变量:品牌,价格,
* 成员方法:打游戏,打电话,
*/
public class Phone {
public static void main(String[] args) {
//创建对象
PhoneTest p = new PhoneTest();
String brand =p.brand;
int price = p.price;
brand ="小米";
price =788;
System.out.println(brand+" "+price);
p.playGame();
p.call();
}
}
class PhoneTest{
String brand ;
int price ;
public void playGame(){
System.out.println("打游戏");}
public void call(){
System.out.println("打电话");
}
}
|
|