aliensbrain
  • Home
  • Study
  • Quizzes
  • 🎤AI Practicefree
  • Notebooks
  • Community
  • Sign in
  • Java Programming Test
  • What of the following is the output of the under given co...
Multiple choice

What of the following is the output of the under given code?

public void sum(){ int a=10,b=2,c=3; if(b>a)&&(c>b){ c++; System.out.println(c=+c); } else{ c--; System.out.println(c=+c); } }

  1. Prints c=3

  2. Prints c=4

  3. Prints c=2

  4. Compilation error

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

Else loop will be executed.

Keep practicing — related questions

  • What will be output from the following statements: System.out.println(1+2+”3”); System.out.println (“1”+2+3);
  • What is the output for the following lines of code? 1: System.out.println(" " +2 + 3); 2: System.out.printl...
  • What is the output for the below code ? public class Test { public static void main(String... args) { int a...
  • What gets printed here... System.out.println("Sum of 5 and 3 is:"+5+3);
  • What is the output for the below code ? 1. public class Test {2. int i=8; 3. int j=9; 4. public static void...
  • What is the output of the following program? public class example { public static void main(String args[]) ...
  • What is the output for the below code ? 1. public class Test { 2. public static void main(String[] args){ 3...
  • What is the output of the following code when compiled and run? Select two correct answers. public class Qu...
Play the full quiz 🎤 Practise this topic out loud
Advertisement
© Aliensbrain | all rights reserved
  • About
  • Contact
  • Terms and Condition
  • Privacy Policy