现有项目
类ArrayMoveDemo
package com.mifeng.acm.ds.stack;
public class ArrayMoveDemo {
public static void main(String[] args){
PrintDemo demo = new PrintDemo();
demo.say();
int[] array = new int[]{4, 2, 1};
System.out.println(array.toString());
for(int i = 0; i< array.length; i++){
if(i>=array.length){
return ;
}
array[i] = array[i+1];
System.out.println(array.toString());
}
}
}
类PrintDemo
package com.mifeng.acm.ds.stack;
public class PrintDemo {
public static void main(String[] args) {
System.out.println("welcome to china");
}
public void say(){
System.out.println("hahahah ");
}
执行前面一个类,与预期一致