I need help


#1

I do not understand what does this do


#2

The question mark is a ternary conditional operator. You can read more on that here

Basically, it takes the form of
statement ? true result : false result;

If you’re still confused, plug these basic statements in and run them.

System.out.println(3 > 4 ? "true" : "false");
System.out.println(3 < 4 ? "true" : "false");
System.out.println(true ? "true" : "false");
System.out.println(false ? "true" : "false");

#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.