Computer Applications
What will be the output of the following code?
int size = 2;
if (size < 0)
System.out.println("Small");
else if (size == 0)
System.out.println("Medium");
else
System.out.printIn("Large");
- Small
- Large
- Medium
- Runtime error
Related Questions
Which of the following are conditional constructs?
Which operator cannot be used with if-else statement?
What will be the output of the following code?
int fruit = 3; switch (fruit + 1) { case 1: System.out.println("Banana"); break ; case 2: System.out.println("Apple"); break ; case 3: System.out.println("Orange"); break ; default : System.out.println("Fruitless"); }
Predict the output of the following code snippet:
int a = 1; int b = 2; if (a == b) System.out.println ("Both values are equal"); else System.out.println ("Values are not equal");