0

Why this code output true?what the explanation?

public class Program { public static void main(String[] args) { if(false) System.out.println("false"); else System.out.println("true"); } }

11th Feb 2020, 6:55 PM
Bayazid Hasan
Bayazid Hasan - avatar
2 Answers
+ 2
Bayazid Hasan , when the condition in the if check is false this option is omitted and then it prints the option in the else clause. The boolean condition must be true to print that option, otherwise it goes to next check and evaluates it again đŸ±
11th Feb 2020, 8:17 PM
TheWh¡teCat 🇧🇬
TheWh¡teCat 🇧🇬 - avatar
0
Thanks.
12th Feb 2020, 12:11 AM
Bayazid Hasan
Bayazid Hasan - avatar