I have this class:
import java.text.DateFormat;
import java.text.SimpleDateFormat;
public class Test {
public static void main(String[] argv) {
DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
String h = df.format(1);
System.out.println(h);//output:
}
}
It compiles without problems with openjdk 7.
AFAIK there’s no DateFormat#format(int).
Is there any implicit cast that converts 1 to Date?
It’s inherited from
Format#format(Object)and theintis being autoboxed toInteger. The value is by the way interpreted as epoch time.