D

Deepak Sahoo • 10.78K Points
Tutor II

Q. What is the output of the following code?

Code:
int x = 10;
int y = 20;
int z = x + y;
System.out.println(z);
  • (A) 10
  • (B) 20
  • (C) 30
  • (D) 40
  • Correct Answer - Option(C)
  • Views: 230
  • Filed under category JAVA

Explanation by: Deepak Sahoo
The values of x and y are added and assigned to z, which is then printed.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.


Question analytics