Multiple choice technology programming languages

class Identifiers { int i1; // 1 int _i2; // 2 int i_3; // 3 int #i4; // 4 int $i5; // 5 int %i6; // 6 int i$7; // 7 } Compile-time errors are generated at which lines?

  1. 1

  2. 2

  3. 3

  4. 4

  5. 5

  6. 6

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

Java identifiers cannot start with # or %. Valid identifier characters are letters, digits, _, and $, but only letters, _, and $ can start an identifier. Lines 4 (#i4) and 6 (%i6) violate these rules.