Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

程式考試問題~有點急!!!

Which is a reserved word in the Java programming language?(choose two)

A. method

B. reference

C. const

D. array

E. goto

Given the following Java code:

Sting s;

System.out.println(“s=”+s);

What is the result?

A. The code compiles and “s=” is printed.

B. The code compiles and “s=null” is printed.

C. The code does not compile because string s is not initialized.

D. The code does not compile because string s can not be referenced.

E. The code complies, but a NullPointerException is thrown when toString is called.

需要每個答案的講解與解答

1 Answer

Rating
  • 1 decade ago
    Favorite Answer

    1. const and goto are Java reserved words. See Java Reserved Words.

    2. Java compiler checks possible failure of initialization of all variables. Since the s is evidently not initialized, the compiler complains for good. The answer is C.

Still have questions? Get your answers by asking now.