Computer Applications
Rewrite the following statement using if else:
int max=215, min=323;
String str= (max>min) ? "Max is greater than Min" : "Min is Greater than Max";
int max=215, min=323;
String str= (max>min) ? "Max is greater than Min" : "Min is Greater than Max";
Java Conditional Stmts
13 Likes
Answer
int max=215, min=323;
String str="";
if (max > min)
str = "Max is greater than Min";
else
str = "Min is Greater than Max";
Answered By
5 Likes
Related Questions
What will be the output of the following code?
int x=2,y=5,a=0; a=x; x=y; y=a; System.out.println("x=" + x + " y=" + y);
Find the error in the given statement:
int x = (a => b) ? "a" : "b";
Find the error, if any, in the following code. Write the correct statement.
int a=5, b=10; int x = (a>b)>true:false;
What will be the value of 'n' after the execution of the code given below?
int x=2, m=1, c=-1; int n = x + c; n = n - c + x; System.out.println(n);