题目:
编写一个手机类(Mobile),包括手机品牌(brand)手机型号(type),方法包括显示手机信息,并编写测试类进行对象的创建。
源代码:
package com.soft.ght;
//手机类
public class Mobile {
String brand,type,name;
public static void main(String[] args) {
// TODO Auto-generated method stub
Mobile ph1 = new Mobile();//声明并实例化Mobile 类对象ph1
Mobile ph2 = new Mobile();//声明并实例化Mobile 类对象ph2
Mobile ph3 = new Mobile();//声明并实例化Mobile 类对象ph3