What is the output of the following code snippet?
public class Main{ public static void main(String[] argv){ 3: int c = 2; 4: int result = 4; 5: result += ++c; 6: System.out.println(result); } }
C.
The code compiles successfully.
public class Main{ public static void main(String[] argv){ int c = 2; int result = 4; result += ++c; System.out.println(result); } }
The code above generates the following result.