java 类和对象的随堂笔记

package com.hanqi;

public class Text2 {
    public static void main(String[] args)
    {
        //构建一个手机new
        phone phone1 =new phone("华为");
        
        //phone1.pinpai="华为";
        phone1.Color="土豪金";
        phone1.Size=5.5;
        phone1.Ishanghuo=true;
        //拨打电话
        phone1.call();
        phone1.call("110");
        //播放音乐
        phone1.play();
        
        //构建另一个手机
                phone phone2 =new phone("小米");
                
                //phone2.pinpai="小米";
                phone2.Color="象牙白";
                phone2.Size=5;
                phone2.Ishanghuo=true;
                //拨打电话
                phone2.call();
                //播放音乐
                phone2.play();
                
        
package com.hanqi;

public class Text2 {
    public static void main(String[] args)
    {
        //构建一个手机new
        phone phone1 =new phone("华为");
        
        //phone1.pinpai="华为";
        phone1.Color="土豪金";
        phone1.Size=5.5;
        phone1.Ishanghuo=true;
        //拨打电话
        phone1.call();
        phone1.call("110");
        //播放音乐
        phone1.play();
        
        //构建另一个手机
                phone phone2 =new phone("小米");
                
                //phone2.pinpai="小米";
                phone2.Color="象牙白";
                phone2.Size=5;
                phone2.Ishanghuo=true;
                //拨打电话
                phone2.call();
                //播放音乐
                phone2.play();
                
        
原文地址:https://www.cnblogs.com/zzyu/p/5498557.html