Multiple choice technology programming languages

  1. class Announce { 5. public static void main(String[] args) { 6. for(int __x = 0; __x < 3; __x++) ; 7. int #lb = 7; 8. long [] x [5]; 9. Boolean []ba[]; 10. enum Traffic { RED, YELLOW, GREEN }; 11. } 12. }

  1. Compilation succeeds

  2. Compilation fails with an error on line 6

  3. Compilation fails with an error on line 7

  4. Compilation fails with an error on line 8

  5. Compilation fails with an error on line 9

  6. Compilation fails with an error on line 10

Reveal answer Fill a bubble to check yourself
C,D,F Correct answer
Explanation

Line 7 is invalid because Java identifiers cannot start with '#'. Line 8 fails compilation because array dimension limits cannot be specified in the type declaration part (e.g., long [5] x or long [] x [5]). Line 10 fails compilation because local enums are not permitted inside methods in standard Java versions where this question originates.