Multiple choice technology programming languages

In the following class definition, which is the first line (if any) that causes a compilation error. Select the one correct answer.public class test { public static void main(String args[]) { char c; int i; c = 'A'; // 1 i = c; //2 c = i + 1; //3 c++; //4 }}

  1. The line labeled 1.

  2. The line labeled 2.

  3. The line labeled 3.

  4. All the lines are correct and the program compiles.

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

In line 3, adding the integer 1 to the integer 'i' produces an int result. Assigning an int value to a char variable requires an explicit cast to prevent a compiler error from a potential loss of precision.