将方法中的对象作参数传回

		Phone two = GetPhone();
        System.out.println(two.brand);
        System.out.println(two.price);
        System.out.println(two.type);

    }

    public static Phone GetPhone(){
        Phone one = new Phone();
        one.brand = "雪梨";
        one.price = 8388;
        one.type = "土豪金2355";
        return one;

相当于传回的是One的地址

猜你喜欢

转载自blog.csdn.net/weixin_49321034/article/details/107456142