I was fooling around with some Date classes when I came upon the following anomaly.
import java.text.DateFormat;
import java.text.ParseException;
public class Class {
public static void main(String[] args) {
DateFormat df = DateFormat.getInstance();
try {
System.out.println(df.parse("12/20/10 1:40 AM"));
} catch(ParseException pe) {
pe.printStackTrace();
}
}
}
This compiles and prints correctly, even though parse(String) returns a Date object. It just seems weird to me that you can call Date's toString() without actually importing Date. Why is this ok?