[1569] in java-interest

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

Re: dynamic lists

daemon@ATHENA.MIT.EDU (Christophe Meessen)
Fri Sep 8 06:06:34 1995

Date: Fri, 8 Sep 1995 08:55:49 +0200
To: ser@jersey.in2p3.fr, java-interest@java.sun.com
From: meessen@cppm.in2p3.fr (Christophe Meessen)

At 10:35 07/09/95 -0700, ser@jersey.in2p3.fr wrote:
...

>The crux of matter is,
>
>   int x;
>
>refers to an instance of x, whereas
>
>   MyClass x;
>
>is a pointer to a non-existant instance of MyClass which I still have to
fill >with
>
>   x = new MyClass();
>
>or some similar pointer manipulation. 
>Personally, I find inconsistancies like this annoying, but acceptable.
After >all, learning the intricacies of pointers was much more difficult
than >remembering that Some Things Are Always Auto-Instantiated by Java, and
Some >Things Aren't.  As long as you observe the casting rules of Java, you
can use >class instance references like pointers in any other language.


I personally don't see any inconsistancies in this syntax.
Because in the specification it is said that it is an error to use the integer
x without having assigned a value to it first.
To be allowed to use a variable you need to instanciate it and it doesn't
matter if it is a base type or not.  So I see it as equivalent.

   int x = 5;
or 
   int x;
   x = 5;

and with MyClass

   MyClass x = new MyClass();
or
   MyClass x;
   x = new MyClass();
>
>--- SER
Bien cordialement,

Ch.Meessen

-
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