Article View: borland.public.jbuilder.java.language
Article #7418Re: How to define/use array of records (user-defined types)?
From: John McGrath TeamB
Date: Fri, 22 Jun 2001 03:27
Date: Fri, 22 Jun 2001 03:27
32 lines
2058 bytes
2058 bytes
On Thu, 21 Jun 2001 16:57:43 -0400, swett@starband.com wrote:
> The link you provided is helpful, but it doesn't provide a
> solution. I'm not trying to read data out of an object at
> this point; I'm trying to load data into an object.
I think that link did provide a solution to your original problem,
which was that you were allocating an array of references to ItemData
objects, but not actually creating a ItemData object. myItemData[0]
contained a null reference, so you got a NullPointerException when you
tried to reference it.
> I've tried the following before and was still encountering a problem:
>
> ItemData[] myItemDataArray = new ItemData[50];
> ItemData myItemData = new ItemData( ); // one object
> myItemData.Number = 575;
> myItemData.Description = "widget";
> myItemData.Cost = 29.95;
> ItemDataArray[0] = myItemData;
I see that you have fixed the original problem. What sort of problem
are you having now?
--
Regards,
John McGrath [TeamB]
---------------------------------------------------
Before sending me e-mail, please read:
http://www.JPMcGrath.net/newsgroups/e-mail.html
Technical Details
Message-ID:
<MPG.159c74dbea28fa8398a2c9@forums.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!193.174.75.178!news-fra1.dfn.de!news-lei1.dfn.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3b315178_1@dnews> <3b318771$1_2@dnews> <3b326283_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,f38dc19b99e1adb5 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-06-21 20:39:21 PST From: John McGrath [TeamB] <ng-b@JPMcGrath.net> Newsgroups: borland.public.jbuilder.java.language Subject: Re: How to define/use array of records (user-defined types)? Date: Thu, 21 Jun 2001 23:27:21 -0400 Message-ID: <MPG.159c74dbea28fa8398a2c9@forums.borland.com> References: <3b315178_1@dnews> <3b318771$1_2@dnews> <3b326283_2@dnews> X-Newsreader: MicroPlanet Gravity v2.30 NNTP-Posting-Host: 209.92.40.60 X-Trace: dnews 993180439 209.92.40.60 (21 Jun 2001 20:27:19 -0700) Lines: 32 X-Authenticated-User: jpmcgrath Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!news.tele.dk!193.174.75.178!news-fra1.dfn.de!news-lei1.dfn.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews