[31] in java-interest

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

Re: syntax of "new"; packages

daemon@ATHENA.MIT.EDU (Jim Graham)
Mon May 1 18:31:38 1995

Date: Mon, 1 May 1995 15:19:53 -0700
From: flar@bendenweyr.Eng.Sun.COM (Jim Graham)
To: java-interest@java.Eng.Sun.COM

Hi Jeremy,

> In browser/hotjava.java, it uses the syntax "new String[12]".  Is
> this the same as "new String()[12]"?  It seems a little odd that
> a new of just an object must have argument parens, even if empty,
> but making an array of them doesn't explicitly require them.

You misunderstand.  That statement is creating a new array, not
a new String object or array of new String objects.  The elements
in that array will all initially be null and you can only store
either null, a String object, or some instance of a subclass of
String into its elements.

I'll your other questions to someone more familiar with the internals
of our compiler syntax...

				...jim

-
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