Question : if else java
Answered by : mizanur-rahaman
if (condition) { // statement
} else if(condition){ // statement
}else{ // statement
}
Source : | Last Update : Tue, 25 Jan 22
Question : If Else In Java
Answered by : msk-sk
// Traditional way
if (20 > 18) { System.out.println("20 is greater than 18");
}
// "efficient" way
int time = 20;
String result = (time < 18) ? "Good day." : "Good evening.";
System.out.println(result);
Source : | Last Update : Mon, 30 May 22
Question : Java if...else Statement
Answered by : samer-saeid
class Main { public static void main(String[] args) { int number = 10; // checks if number is greater than 0 if (number > 0) { System.out.println("The number is positive."); } // execute this block // if number is not greater than 0 else { System.out.println("The number is not positive."); } System.out.println("Statement outside if...else block"); }
}
Source : | Last Update : Mon, 30 May 22
Question : Java if...else...if Statement
Answered by : samer-saeid
if (condition1) { // codes
}
else if(condition2) { // codes
}
else if (condition3) { // codes
}
.
.
else { // codes
}
Source : | Last Update : Mon, 30 May 22