我剛開始學習Java和我,直到達到陣列,我在「與」替代空間「準備這個節目(從一本書)。」 (點),我不能夠理解這個特定的行(它不是在書裏我從學習甚至提到)。請在我的Java代碼中解釋這個特定的行嗎?
請幫我一把。
class SpaceRemover{
public static void main(String[] args){
String mostFamous = "Hey there stackoverFLow ";
char [] mf1 = mostFamous.toCharArray();
for(int dex = 0; dex<mf1.length;dex++)
{
char current = mf1[dex]; // What is happening in this line ??
if (current != ' ') {
System.out.print(current);
}
else{
System.out.print('.');
}
}
System.out.println();
}
}
有人請解釋什麼是發生 「焦電流= MF1 [DEX]。」
非常感謝您的時間。
這些將有助於理解它:http://docs.oracle.com/javase/tutorial/java/nutsandbolts/for.html http://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays .html – 2013-06-24 06:43:13