Given:
public class Palindrome {
public static int main(String[] args) {
System.out.print(args[1]);
return 0;
}
}
And the commands:
javac Palindrome.java
java Palindrome Wow Mom
java Palindrome Wow Mom
What is the result?
A. Compilation fails
B. The code compiles, but does not execute.
C.
Paildrome
D.
Wow
E.
Mom
题解
Java 程序进入点的 main 方法声明方式为「public static void main(String[] args) 」或是「public static void main(String... args) 」。在这里并没有声明出正确的程序进入点,回传型态不是 void,因此使用「java」指令运行时,只会提示回传型态必须使用 void。
