🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: aus.computers.java
Article #704

Re: help with arrayList urgent

#704
From: Steve Strongheart
Date: Mon, 22 May 2000 00:00
36 lines
2176 bytes
sumguy ~
    You need to cast the java.lang.Object returned from myArrayList.get(int)
into an Object that has the desired method.

 (myClass)   myArrayList.get(int).someMethod()
assuming the Object is castable to  myClass and that myClass contains
#someMethod()

~S~

someguy <someguy@somewhere.com> wrote in message
news:958986598.802617@brs.ihug.com.au...
> greetings
>
> I have created an arraylist, which i have used to store objects of a
purpose
> desinged class that holds a string and integer, and the toString returns
> both in a string "ie return(myString +myInteger);".  I would like to know
> how to access the methods of my class from the arraylist.
>
> ie myArrayList.get(index).someMethodFromMyClass
>
> Interstingly enough, i can create new objects and add them to my list.  I
> can get the values of these objects, but i cant invoke methods built into
> them to modify their values.
>
> The reason i have used arraylist is so that i dont have define the size of
> the arraylist - and for what i am doing this is an advantage.  However if
> you have any better ideas then i would be glad to hear them.
>
> Please if you know how i can access these method i would appreciate it.
>
>
>
>
>
Technical Details
Message-ID: <392a7884@news.dandy.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <958986598.802617@brs.ihug.com.au>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fdb77,52d7c09c5f8362a6
X-Google-Attributes: gidfdb77,public
X-Google-Thread: 113ae9,52d7c09c5f8362a6
X-Google-Attributes: gid113ae9,public
X-Google-Thread: 10d6db,52d7c09c5f8362a6
X-Google-Attributes: gid10d6db,public
From: "Steve Strongheart" <Strong_HeartGreenEggsAndSpam@bigfoot.com>
Subject: Re: help with arrayList urgent
Date: 2000/05/22
Message-ID: <392a7884@news.dandy.net>
X-Deja-AN: 626257667
References: <958986598.802617@brs.ihug.com.au>
X-Original-NNTP-Posting-Host: 206.135.129.6
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-Complaints-To: abuse@eni.net
X-Trace: paxfeed.eni.net 959084786 18196 206.135.129.6 (23 May 2000 12:26:26 GMT)
Organization: Epoch Internet Inc.
X-MSMail-Priority: Normal
NNTP-Posting-Date: 23 May 2000 12:26:26 GMT
Newsgroups: aus.computers.java,comp.lang.java.advocacy,comp.lang.java.help