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.Date
you can be sure it won't be confused with some otherDate
class in a different package. However if yourimport
statement includesjava.util.*
orjava.util.Date
already, then just sayingDate
will be unambiguous enough and the compiler will know whichDate
you mean.