[46] in java-interest
Re: Strange "new" syntax
daemon@ATHENA.MIT.EDU (Arthur van Hoff)
Thu May 4 12:56:37 1995
Date: Thu, 4 May 1995 09:39:01 -0700
From: Arthur.Vanhoff@Eng.Sun.COM (Arthur van Hoff)
To: java-interest@java.Eng.Sun.COM
Hi Jeremy,
> > It creates a new instance of the class named by the string argument.
> > It can be any expression resulting in a string as long as it
> > results in a valid public class name. The return type is Object.
>
> What does it do about calling a constructor? Does it call the
> default/no-arg constructor? I noticed where it's used there's
> code like
> i = (FormItem) new("browser.forms.text");
> // ...
> i.initialize(f, form, this);
It calls the default constructor (ie no arguments).
> Does this mean a class has to be written with this kind of use in
> mind?
Yes.
Have fun,
Arthur van Hoff (avh@eng.sun.com)
http://java.sun.com/people/avh/
Sun Microsystems Inc, M/S UPAL02-301,
100 Hamilton Avenue, Palo Alto CA 94301, USA
Tel: +1 415 473 7242, Fax: +1 415 473 7104
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com