String displayName = (name != null ? name : "Unknown");
----
Instead you can use the Elvis operator, named for the resemblance to Elvis' hair style.
Instead, you can use the Elvis operator (named for the resemblance to Elvis' hair style).
The following example shows how to use the Elvis operator:
[source,java,indent=0]
[subs="verbatim,quotes"]
@ -1135,7 +1136,7 @@ Instead you can use the Elvis operator, named for the resemblance to Elvis' hair
@@ -1135,7 +1136,7 @@ Instead you can use the Elvis operator, named for the resemblance to Elvis' hair
System.out.println(name); // 'Unknown'
----
Here is a more complex example.
The following listing shows a more complex example: