Consider this code: “int v = 20; –v; System.out.println(v++);”. What value is printed, what value is v left with?

1
Consider this code: “int v = 20; –v; System.out.println(v++);”. What value is printed, what value is v left with?

LANGUAGE: JAVA

CHALLENGE:

Consider this code: “int v = 20; –v; System.out.println(v++);”. What value is printed, what value is v left with?

SOLUTION:

19 is printed, v ends up with 20

CHALLENGE:

Consider this code: “int s = 20; int t = s++ + –s;”. What are the values of s and t?

SOLUTION:

s is 20 and t cannot be deterined

One comment

Add comment