Sunday, 5 November 2017

java input output problems



Problem 04:
What is the output of  the following question
int a=3,b=4,c=3;
 if(a==b)
     System.out.println("a and b are equal");
 else if(a==c)
     System.out.println("a and c are equal");
 else
     System.out.println("Nothing are equals");
Output:
A and c are equal
Problem 05:
What is the output of  the following question
int a=3,b=3,c=3;
 if(a==b)
     System.out.println("a and b are equal");
  if(a==c)
     System.out.println("a and c are equal");
 else
     System.out.println("Nothing are equals");
Output:
A and b are equal
A and c are equal
Problem 06:
What is the output of  the following question
int a=3,b=3,c=3;
 if(a==b)
     System.out.println("a and b are equal");
  if(a==c)
     System.out.println("a and c are equal");
 if(b==c)
     System.out.println("b and c are equal");
Output:
A and b are equal
A and c are equal
B and c are equal

No comments:

Post a Comment