Q:

What is the output of the following java programs?

0

What is the output of the following java programs?

public class Program1{ 
 public static void main(String[] args) 
 {
 int n=25, a;
 while(n > 0)
 {
 a = n % 2;
 System.out.print(a); 
 n = n / 2;
 }
 }

------------------

public class Program2{
 public static void main(String[] args) 
 {
 int x=7,y=7;
 char letter = ( x++ > y ? 'd': 'w' );
 switch(letter)
 {
 case 'w': System.out.println ("wow"); 
 case 'y': System.out.println ("you"); 
 break; 
 case 'd': System.out.println ("did it");
 }
 }
}

------------------

 public class Program3{ (
 public static void main(String[] args) 
 {
 int i=30,minV=300,v=250,minI=25;
 if (i >= minI )
 if (v >= minV )
 System.out.println ("big");
 else System.out.println ("medium");
 else System.out.println ("small");
 }
}

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

program1 output:

------------------------

10011

 

program2 output:

------------------------

wow

you

 

program3 output:

------------------------

medium

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now