[38] in java-interest

home help back first fref pref prev next nref lref last post

Strange "new" syntax

daemon@ATHENA.MIT.EDU (Jeremy Fitzhardinge)
Wed May 3 11:40:16 1995

From: jeremy@sour.sw.oz.au (Jeremy Fitzhardinge)
To: java-interest@java.Eng.Sun.COM
Date: Wed, 3 May 1995 15:03:49 +1000 (EST)

I came across a piece of syntax for the new operator which (as far
as I can tell) is completely undocumented in the language spec.

The syntax is new(string), where "string" appears to be an expression
evaluating to a String with a class name in it.  Sometimes it's
used with an expression, but it often just has a constant string.

So what does it do?  I presume it doesn't call a constructor,
because no args are passed, or if it does it's the no-arg one.  If
that's all it does, I don't understand why it's used with a constant
string.

I suppose as far as compile-time type checking is concerned, the
new evaluates to something of type Object which you have to cast
to something that can use.  I got the impression that the runtime
does all its type checking before actually running the code, but
I can't see how it can in this case.

What exactly is this?

	J

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post