Not only in Java, this syntax is available within PHP, Objective-C too. In the following link it gives the following explanation, which is quiet good to understand it: A ternary operator is some operation operating on 3 inputs. It's a shortcut for an if-else statement, and is also known as a conditional operator.

Context Explanation

In Perl/PHP it works as: What is the Java ?: operator called and what does it do? 7 It is the Bitwise xor operator in java which results 1 for different value of bit (ie 1 ^ 0 = 1) and 0 for same value of bit (ie 0 ^ 0 = 0) when a number is written in binary form. ex :- To use your example: The binary representation of 5 is 0101. The binary representation of 4 is 0100.

Insight Material

While hunting through some code I came across the arrow operator, what exactly does it do? I thought Java did not have an arrow operator. return (Collection<Car>) CollectionUtils.select(list... What does the arrow operator, '->', do in Java? - Stack Overflow In any Java source file using generics the old non-generic types should be forbidden (you can always use <?> if interfacing to legacy code) and the useless diamond operator should not exist.

Final Conclusion

Since java.lang.String class override equals method, It return true if two String object contains same content but == will only return true if two references are pointing to same object. Here is an example of comparing two Strings in Java for equality using == and equals() method which will clear some doubts: The @ symbol denotes a Java Annotation. What a Java annotation does, is that it adds a special attribute to the variable, method, class, interface, or other language elements.