is there a Java equivalent to null coalescing operator (??) in C#? [duplicate]

Is it possible to do something similar to the following code in Java

int y = x ?? -1;

More about ??

6 Answers
6

Leave a Comment