哪位给看看这个小代码为什么不能运行

asiazmm 2007-06-20 04:24:26
public class TestArrayCopy{
public static void main(String [] args){
int x[] = new int[]{1,2,3,4,5};
int y[] = new int[]{7,8,9,6,5,4};
System.arraycopy(x,0,y,0,3);
for(int i = 0;i < x.length;i++){
System.out.println(x[i]);
System.out.println();
}
for(int j = 0;j < y.length;j++){}{
System.out.print(y[j]);
System.out.println();
}
}
}
...全文
215 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
yifuzhiming 2007-06-25
  • 打赏
  • 举报
回复
走过路过
mengpiao_shuiya 2007-06-25
  • 打赏
  • 举报
回复
搂主试试吧
mengpiao_shuiya 2007-06-25
  • 打赏
  • 举报
回复
public class TestArrayCopy{
private static boolean i;
private static int j;
public static void main(String [] args){
int x[] = new int[]{1,2,3,4,5};
int y[] = new int[]{7,8,9,6,5,4};
System.arraycopy(x,0,y,0,3);
for(int i = 0;i < x.length;i++){
System.out.println(x[i]);
System.out.println();
}
for(int j = 0;j < y.length;j++){}{
System.out.print(y[j]);
System.out.println();
}
}
}
fiore 2007-06-24
  • 打赏
  • 举报
回复
多少给点分吧
java0000000 2007-06-24
  • 打赏
  • 举报
回复
public class TestArrayCopy
{
public static void main(String [] args)
{
int x[] = new int[]{1,2,3,4,5};
int y[] = new int[]{7,8,9,6,5,4};

System.arraycopy(x,1,y,0,4);

for(int i = 0;i < x.length;i++)
{
System.out.println(x[i]);
System.out.println();
}

for(int j = 0;j < y.length;j++)
{
System.out.print(y[j]);
System.out.println();
}
}

}

tdy1234 2007-06-20
  • 打赏
  • 举报
回复
for(int j = 0;j < y.length;j++){}//这里为什么有2对括号呀大哥
{
System.out.print(y[j]);
System.out.println();
}
yonglr899 2007-06-20
  • 打赏
  • 举报
回复
for(int j = 0;j < y.length;j++){}{
System.out.print(y[j]);
System.out.println();
}
写错了,多了一括号,应该为:
for(int j = 0;j < y.length;j++){
System.out.print(y[j]);
System.out.println();
}

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧