Question : java else if statements
Answered by : helpless-heron-rcccodwtqljq
System.out.println("How many sattelites does JUPITER have ??"); C = scan.nextInt(); if (C == 79) { System.out.println("Congrats ! You got the Third Question Right :)"); points = points + 1; } else if (C != 79) { System.out.println("Sorry but your answer is wrong :("); }
Source : | Last Update : Fri, 30 Oct 20
Question : java if else
Answered by : syed-nayeem-ridwan
if (a > b){ // your code to execute
}
else if (b > c){ // your code to execute
}
else { // your code to execute
}
Source : | Last Update : Thu, 10 Aug 23
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 : 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