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);
}
}







网友评论