Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Replies
    19
    Views
    2,180

    Re: ArrayList is returning null

    Try compiling with the javac command so you can get error messages if you can't figure out how to use the IDE.
  2. Replies
    19
    Views
    2,180

    Re: ArrayList is returning null

    Then where is the ending ]


    ArrayList<String> al = new ArrayList<String>();
    al.add("SSS");
    System.out.println(al); // [SSS]
  3. Replies
    19
    Views
    2,180

    Re: ArrayList is returning null

    sorry, I have no idea what you are talking about.
  4. Replies
    19
    Views
    2,180

    Re: ArrayList is returning null

    Why are you adding a null entry to the list of listeners?


    It depends on what the code is supposed to be doing. If you need the contents in an array, that would be the method to use.
  5. Replies
    19
    Views
    2,180

    Re: ArrayList is returning null

    Where did the [ on the second line before the null come from?

    What does the toArrar() method do?

    If mycustomer is an arraylist, how do you want to get to its contents so you can display them?
  6. Replies
    19
    Views
    2,180

    Re: ArrayList is returning null

    You need to track the data from where it enters the program to where you are getting null values instead of the data.

    Where does the "[null null" come from? With the leading [
  7. Replies
    19
    Views
    2,180

    Re: ArrayList is returning null

    Where does the null value come from? What variable is getting set to null? Where do you originally have the data? What is the path of the data from its source to where you want to get it for display...
  8. Replies
    19
    Views
    2,180

    Re: ArrayList is returning null

    Yes, Making the arraylists class members (and not shadowing them in methods) will allow all the methods in the class to access them to add and get data.
  9. Replies
    19
    Views
    2,180

    Re: ArrayList is returning null

    If you want different methods in the class to be able to get the data in the arraylist, you should define it at the class level and assign it a value.
    You should NOT define a variable in a method...
  10. Replies
    19
    Views
    2,180

    Re: ArrayList is returning null

    One problem I see is that the myCustomer variable is defined and given a value inside of a method.
    When the method exits, that variable and its values are gone.
Results 1 to 10 of 10