Topic: 菜鸟的困惑 (incompatible types; array required; foreach not applicable) |
Print this page |
1.菜鸟的困惑 (incompatible types; array required; foreach not applicable) | Copy to clipboard |
Posted by: cory Posted on: 2005-05-10 19:30 请尽量用准确的文字描述作为标题 consider cut-n-pasting rather than attaching an image String[] greeting = new String[3]; 最近机子老出现一些莫名其妙的问题,连非常的简单的显示字符串数组的程序都会出现无数错,比如: public class Welcome { public static void main(String[] args) { String greeting = new String[3]; greeting[0]= "dsfjksdjfksdj"; greeting[1]= "dsfjksdjfksdj"; greeting[2]= "dsfjksdjfksdj"; for(String g : greeting) System.out.println(g); } }都会有错,请同志们快帮帮我吧! |
2.Re:菜鸟的困惑 [Re: cory] | Copy to clipboard |
Posted by: undefined Posted on: 2005-05-10 20:17 public class aa { public static void main(String[] args) { String [] greeting = new String[3]; greeting[0]= "dsfjksdjfksdj"; greeting[1]= "dsfjksdjfksdj"; greeting[2]= "dsfjksdjfksdj"; for(int i=0 ; i<3;i++ ) System.out.println(greeting[i]); } } 这样你在试一下,看看我改过的你的代码和你原来的有什么区别? |
3.Re:菜鸟的困惑 [Re: undefined] | Copy to clipboard |
Posted by: cory Posted on: 2005-05-10 22:02 你那种方法我以前也试过,不过,我学了5.0版本后,就用了我上面的方式编写了,那不会有错的.其实,我看你那个后又试了一次,还是不行呀!郁闷! |
4.Re:菜鸟的困惑 (incompatible types; array required; foreach not applicable) [Re: cory] | Copy to clipboard |
Posted by: cory Posted on: 2005-05-10 22:03 补充一下,你们说可能是我的版本有问题吗? |
5.Re:菜鸟的困惑 (incompatible types; array required; foreach not applicable) [Re: cory] | Copy to clipboard |
Posted by: why Posted on: 2005-05-11 00:48 cory wrote: I don't know how you could claim "那不会有错的". PLEASE read carefully!! (did you read my notes on your original post?) String[] greeting = new String[3]; Please try to use the editing features of this forum rather than making another post. |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |