Review Questions

2.7 Which of the following lines are valid declarations?

Select the three correct answers.

  1. char a = '\u0061';

  2. char 'a' = 'a';

  3. char \u0061 = 'a';

  4. ch\u0061r a = 'a';

  5. ch'a'r a = 'a';

2.8 Given the following code within a method, which statement is true?
int a, b;
b = 5;

Select the one correct answer.

  1. Local variable a is not declared.

  2. Local variable b is not declared.

  3. Local variable a is declared but not initialized.

  4. Local variable b is declared but not initialized.

  5. Local variable b is initialized but not declared.

2.9 In which of these variable declarations will the variable remain uninitialized unless explicitly initialized?

Select the one ...

Get Programmer's Guide to Java™ Certification, A: A Comprehensive Primer, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.