帖子标题:代码优化
问题内容:假如不要java类库,这段代码怎么优化啊?
public class Demo{
public static void main(String args[]){
int score[]=null;
score=new int[10];
for(int i=0;i<10;i++){
score=i ;
System.out.print(score+(i==9?"":","));
}
System.out.println();
for(int i=0;i<5;i++){
int temp=0;
temp=score;
score=score[9-i];
score[9-i]=temp;
}
for(int j=0;j<10;j++){
System.out.print(score[j]+(j==9?"":","));
}
}
}
连接:http://bbs.itheima.com/thread-45360-1-1.html |