IceBlock iceBlock = new IceBlock

2023-06-17  本文已影响0人  哈迪斯Java

public class Demo {
public static void main(String[] args) {
int a[] = { 1, 3, 5, 7 };
int tmp = a[0];
a[0] = a[2];
a[2] = tmp;
tmp = a[1];
a[1] = a[3];
a[3] = tmp;
for (int num : a) {
System.out.print(num + " ");
}
}
}

public class IceBlock {

public IceBlock() {
    System.out.println("商家默认可乐里没有冰块……");
}

public IceBlock(String name, int number) {
    System.out.println(name + "要求向可乐里放入" + number + "个冰块。");
}

public static void main(String[] args) {
    IceBlock block = new IceBlock();
    IceBlock iceBlock = new IceBlock("张三", 3);
}

}

上一篇 下一篇

猜你喜欢

热点阅读