Null-safe Method invocation Java7
问题 I want to get details about this feature of Java7 like this code public String getPostcode(Person person) { if (person != null) { Address address = person.getAddress(); if (address != null) { return address.getPostcode(); } } return null; } Can be do something like this public String getPostcode(Person person) { return person?.getAddress()?.getPostcode(); } But frankly its not much clear to me.Please explain? 回答1: Null-safe method invocation was proposed for Java 7 as a part of Project Coin,