私はプログラミングが初めてで、今日 Java を使い始めました。DrJava エディタを使用して、Robert Sedgewick と Kevin Wayne による「Introduction to Programming in Java」のオンライン版を読んでいます。
私が不思議に思った特定の演習があります:
Modify UseArgument.java to make a program UseThree.java that takes three names and prints out a proper sentence with the names in the reverse of the order given, so that for example, "java UseThree Alice Bob Carol" gives "Hi Carol, Bob, and Alice.".
私の結果は次のようになります。
public class UseThree {
public static void main(String[] args) {
System.out.print("Hi, ");
System.out.print(args[2]);
System.out.print(", ");
System.out.print(args[1]);
System.out.print(", and ");
System.out.print(args[0]);
System.out.println(".");
}
}
今、私が入力java UseThree Alice Bob Carol
すると、Hi, Carol, Bob, and Alice.
System.out.println
しかし、それは新しい行に印刷されると思いました。
こんな結果になるんじゃないの?
Hi, Carol, Bob and Alice
.
このトピックに光を当てていただければ幸いです。最初から物事を正しく進めたいと思います。前もって感謝します。
ドイツからのご挨拶、
カディール