0

How is the output of this code true?

boolean s = !!true; if (!s) System.out.println(!s); else System.out.println(!!s);

7th Aug 2019, 3:29 PM
Samuel
Samuel - avatar
2 Réponses
+ 2
!true = false for type boolean, !!true = false -> true ________ public class Program { public static void main(String[] args) { boolean s = !!true; System.out.println (s); //true if (!s) //false System.out.println(!s); else System.out.println (s); //true System.out.println(!!s); //true } }
7th Aug 2019, 3:55 PM
Jakub ⚡
Jakub ⚡ - avatar
0
Nice!
11th Aug 2019, 3:14 PM
Juan Debenedetti
Juan Debenedetti - avatar