Java does not really work like Javascript, though recent changes brought by Java 10 and local variable type inference may help a bit with this. Before Java 10, objects were specifically defined (ah well, even after Java 10) and interpreted, so when you have
AJSDate startDate = new AJSDate("20090811");
... it tells the JVM you want an object of type AJSDate to be generated with that specific String object, injected into the provided constructor (I assume by you).
With Java 10 when you have local variables, you can however have something along the lines of this (local variable type inference):
public void someMethod() {
var startDate = new AJSDate("20090811");
}
The Java 10 method using var gets really close to how Javascript behaves sometimes, but not entirely. Security of an app, relies heavily on type safety. Having something like this:
AJSDate startDate = "20090811";
Would pretty much through an error, because you would want to equate two different object types.