0
How is the output of this code true?
boolean s = !!true; if (!s) System.out.println(!s); else System.out.println(!!s);
2 odpowiedzi
+ 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
}
}
0
Nice!