The methods is a basic part of the system core.
public java.util.Date getCurDate(){...}
public Date getCurDate(){...}
What is the advantages and disadvantages of writing this return type?
The methods is a basic part of the system core.
public java.util.Date getCurDate(){...}
public Date getCurDate(){...}
What is the advantages and disadvantages of writing this return type?
The return type needs to specify an unambiguous type. By using a fully qualified type name like
java.util.Dateyou can be sure it won't be confused with some otherDateclass in a different package. However if yourimportstatement includesjava.util.*orjava.util.Datealready, then just sayingDatewill be unambiguous enough and the compiler will know whichDateyou mean.