Results 1 to 3 of 3
Thread: Array List problem
- 06-24-2008, 04:24 PM #1
Member
- Join Date
- Jun 2008
- Posts
- 9
- Rep Power
- 0
Array List problem
im having a problem with an Array list. this is my first post, so im not sure if its the right place to put it.
im new to arraylists
i have one arraylist called: printlist
i have a class: class B
class B has the array list
class B makes class C and adds that instance to the array list.
when it is all finished.
i want class A to get the arraylist which is in my class B (printlist). i do this through a return method which is in class B. this seems to work.
my problem now is though that when i try to use any of the data which i expect to be in class A's copy of the array list it wont work. e.g.
in class B, the following code works:
String filepath = printlist.get(0).getFilePath();
when i try that in class A it does not, and i get this error:
cannot find symbol : method getBrandProd()
any ideas.
thanks guys.
- 06-24-2008, 07:07 PM #2
Simple idea, drill-down call-chain is easily missed
The calls have to 'link-up' ... that is not a terminology that is best. Call chain is a better word, it is like links in a chain:
The machine is not passing a copy of the ArrayList, it passes a copy of the finder information that the machine uses to find the ArrayList, so we are getting the actual item from the ArrayList in class CJava Code:class A { class B = new B(); ListItem getBrandProd(){ B.ListItem getBrandProd(); } class B { ListItem getBrandProd(){ return C.getBrandProd(); }Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 06-25-2008, 07:30 AM #3
Member
- Join Date
- Jun 2008
- Posts
- 9
- Rep Power
- 0
Similar Threads
-
How to convert List to Array
By Java Tip in forum java.langReplies: 0Last Post: 04-16-2008, 10:37 PM -
Converting array to list and sorting it
By Java Tip in forum java.langReplies: 0Last Post: 04-16-2008, 10:36 PM -
Array List Problem
By khamuruddeen in forum New To JavaReplies: 1Last Post: 12-22-2007, 08:10 AM -
using an Array list
By toad in forum New To JavaReplies: 1Last Post: 11-18-2007, 09:08 PM -
how to remove an object from the array list
By cecily in forum New To JavaReplies: 3Last Post: 08-02-2007, 02:26 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks