我總是與增強for循環混淆。我有這樣的例子增強for循環 - JAVA
public class NonRepeatedChar
{
public static void main(String[] args)
{
String str = "javapassion";
int[] count = new int[128];
char[] charArr = str.toLowerCase().toCharArray();
for (char c : charArr)
{
count[c]++;
}
for (char c : charArr)
{
if (count[c] == 1)
{
System.out.println("First Non repeated character is : " + c);
break;
}
}
}
}
在上述
因此,在for循環它說計數第一併[c] ++中,這意味着一個新的數組計數被初始化並且在迭代遞增的C值被存儲?
我們無法讀取這段代碼 – irreputable 2011-01-23 21:43:29