Multiple choice technology programming languages

The following a legal Java statement

  1. m1 = new TextField("sixty");

  2. 1a = 6;

  3. add(m1);

  4. m1.setText("Hello world);

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

Option C 'add(m1)' is a valid Java method call statement that adds component m1 to a container (common in AWT/Swing). Option A is incorrect because 'new TextField("sixty")' must be assigned to a variable of type TextField/Component. Option B '1a = 6' is invalid because Java identifiers cannot start with a digit. Option D has an unclosed string literal - the closing quote is missing after 'Hello world'.