Multiple choice technology programming languages

1 String #name = "Jane Doe"; 2 int $age = 24; 3 Double _height = 123.5; 4 double ~temp = 37.5; Which two statements are true?

  1. . Line 1 will not compile

  2. . Line 2 will not compile

  3. . Line 3 will not compile

  4. . Line 4 will not compile

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

Line 1 fails because # is not a valid character to start an identifier in Java - identifiers must begin with a letter, underscore _, or dollar sign $. Line 4 fails because ~ is never valid in an identifier. Lines 2 and 3 compile: \$age (dollar is valid) and _height (underscore is valid) are legal identifiers. The key distinction is the allowed starting characters for Java identifiers.