题目:
编写一个手机类(Mobile),包括手机品牌(brand)手机型号(type),方法包括显示手机信息,并编写测试类进行对象的创建。
源代码:
package org.java.application;
//手机类
class Mobile{
String brand;
String type;
//有参构造函数构造一个对象
public Mobile(String brand , String type){
this.brand = brand;
this.type = type;
}
public boolean foo(String brand , String type){
System.out.println("brand:"+brand+"----"+"type:"+type);//输出手机信息
return true;
}
}
//有参构造函数构造一个对象
class Te