Results 1 to 3 of 3
  1. #1
    kurenai is offline Member
    Join Date
    Jun 2008
    Posts
    9
    Rep Power
    0

    Default 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.

  2. #2
    Nicholas Jordan's Avatar
    Nicholas Jordan is offline Senior Member
    Join Date
    Jun 2008
    Location
    Southwest
    Posts
    1,018
    Rep Power
    8

    Default 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:
    Java Code:
    class A {
        class B = new B();
        ListItem getBrandProd(){
            B.ListItem getBrandProd();
    }
    class B {
        ListItem getBrandProd(){
            return C.getBrandProd();
    }
    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 C
    Introduction to Programming Using Java.
    Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor

  3. #3
    kurenai is offline Member
    Join Date
    Jun 2008
    Posts
    9
    Rep Power
    0

Similar Threads

  1. How to convert List to Array
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 11:37 PM
  2. Converting array to list and sorting it
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-16-2008, 11:36 PM
  3. Array List Problem
    By khamuruddeen in forum New To Java
    Replies: 1
    Last Post: 12-22-2007, 09:10 AM
  4. using an Array list
    By toad in forum New To Java
    Replies: 1
    Last Post: 11-18-2007, 10:08 PM
  5. how to remove an object from the array list
    By cecily in forum New To Java
    Replies: 3
    Last Post: 08-02-2007, 03:26 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •