What means ?. in Java? [duplicate]
This question already has an answer here:
Null-safe Method invocation Java7 3 answers
I've got such piece of code:
private String getUsername(PersonalAccount account) {
User usr = (User)account?.usr
String name = usr?.getName()
return name
}
And in PersonalAccount class we've got field:
SimpleUser usr
User extends SimpleUser
What means this: ?. in this two lines?
User usr = (User)account?.usr
String name = usr?.getName()
No comments:
Post a Comment