🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #196

Re: Array problem

#196
From: Raul Lorenzo
Date: Fri, 26 May 2006 13:47
40 lines
2040 bytes
Ok, It�s like C++.....I think Java create all the structure autom�tically.
Thanks

Lori M Olson [TeamB] escribi�:
> Raul Lorenzo wrote:
>> Hello,
>>
>> I have this piece of code
>> /***************************************************/
>> int index=0;
>> AttributeREM RoleREM[]=null;
>> RoleREM=new AttributeREM[asociationREM.numero_roles];
>> RoleREM[index].oid="hello";
>> /***************************************************/
>>
>> Java reports me a null Pointer exception at RoleREM[index].oid="hello";
>> Why?
>> asociationREM.numero_roles is always >0
>>
>> AttributeREM is a class something like this
>>
>> class AttributeREM
>> {
>> public String oid;
>> public String name;
>> ...
>> ...
>> };
>>
>> Thanks in advance
>>
> 
> This statement:
> 
> RoleREM=new AttributeREM[asociationREM.numero_roles];
> 
> Creates an array, but it does not populate the array with instances of
> AttributeREM.  The contents of the array will all be null, until you put
> something in it.
> 
Technical Details
Message-ID: <447706bc@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!news-east.rr.com!news.rr.com!news-out2.newsfeeds.com!local!sp6iad.superfeed.net!in2.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4475f04d@newsgroups.borland.com> <44761903$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,a661d771a96526a0
X-Google-Attributes: gidf74b3,public
X-Google-Language: ENGLISH,ASCII
Subject: Re: Array problem
From: Raul Lorenzo <rlorenb@agalisa.es>
Date: Fri, 26 May 2006 15:47:40 +0200
Message-ID: <447706bc@newsgroups.borland.com>
References: <4475f04d@newsgroups.borland.com> <44761903$1@newsgroups.borland.com>
Lines: 40
NNTP-Posting-Host: 83.43.50.56
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!news-east.rr.com!news.rr.com!news-out2.newsfeeds.com!local!sp6iad.superfeed.net!in2.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
Newsgroups: borland.public.jbuilder.java.language
X-Trace: newsgroups.borland.com 1148651196 83.43.50.56 (26 May 2006 06:46:36 -0700)
User-Agent: Thunderbird 1.5.0.2 (Windows/20060308)
MIME-Version: 1.0
In-Reply-To: <44761903$1@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit