Article View: borland.public.jbuilder.java.language
Article #7412Re: How to define/use array of records (user-defined types)?
From: swett
Date: Thu, 21 Jun 2001 20:57
Date: Thu, 21 Jun 2001 20:57
35 lines
2142 bytes
2142 bytes
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'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; So how can I load an array of objects without getting errors? Thanks again. "Torsten Welches" <torsten.welches@who.cares.netcologne.de> wrote in message news:3b318771$1_2@dnews... > > <swett@starband.com> wrote: > > >I've tried creating a new class that only has data members in > >it (no methods), but every time I tried to access a data > >member at run time, I get a NullPointerException error. > > >ItemData[] myItemData = new ItemData[50]; > >myItemData[0].Number = 575; > >myItemData[0].Description = "widget"; > >myItemData[0].Cost = 29.95; > > check the third paragraph, it explains why you get a > NullPointerException: > http://java.sun.com/docs/books/tutorial/java/data/arraysOfObjects.html > > Torsten
Technical Details
Message-ID:
<3b326283_2@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3b315178_1@dnews> <3b318771$1_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 14:25:04 PST Reply-To: <swett@bcswebsite.com> From: <swett@starband.com> Newsgroups: borland.public.jbuilder.java.language References: <3b315178_1@dnews> <3b318771$1_2@dnews> Subject: Re: How to define/use array of records (user-defined types)? Date: Thu, 21 Jun 2001 16:57:43 -0400 Lines: 37 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 148.71.34.6 Message-ID: <3b326283_2@dnews> X-Trace: dnews 993157763 148.71.34.6 (21 Jun 2001 14:09:23 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-03!supernews.com!newsfeed.wirehub.nl!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews