Search:

Type: Posts; User: Norm

Search: Search took 0.21 seconds.

  1. Re: Building a linked list whose nodes data is the sum of nodes of other list

    That raises the question about why create a new instance of the List class just to call its sum2List() method.
    That method is in all instances of the List class. So it could be called with the...
  2. Re: Building a linked list whose nodes data is the sum of nodes of other list

    Where is the list with the sums in it? The sum2List() creates a list and returns it. What happens to that list?

    There is confusion in the comments describing what the code does:


    List L...
  3. Re: Building a linked list whose nodes data is the sum of nodes of other list

    That is not the solution. printing the list inside of the method was for debugging. The list needs to be printed in the main() method.
  4. Re: Building a linked list whose nodes data is the sum of nodes of other list

    What happens to the list: L that is returned by the sum2List() method?
    Does the caller of the method save it?

    Did you print the list: L at the end of the sum2List() method so you see what is...
  5. Re: Building a linked list whose nodes data is the sum of nodes of other list

    Did you find the problem by looking at the output for the println statements you added?
    Does the sum2List() method work correctly? Print out the list it creates: L at the end of the method to see if...
  6. Re: Building a linked list whose nodes data is the sum of nodes of other list

    The formatting is a little better but there are still statements that are not indented.

    It looks like nothing is printed by printList() for the list: l.
    Try debugging the sum2List() method by...
  7. Re: Building a linked list whose nodes data is the sum of nodes of other list

    What does the program output when it executes?
    Please copy the full contents of the command prompt window and paste it here.

    A suggestion for the initial testing: Use short lists (say with only...
  8. Re: Building a linked list whose nodes data is the sum of nodes of other list

    What does the program output when it executes? Please copy the full contents of the command prompt window and paste it here.

    BTW The code does NOT follow standard java naming conventions. Class...
  9. Re: Building a linked list whose nodes data is the sum of nodes of other list

    Can you make a small, complete program that compiles and executes for testing to see the problem?
    Be sure to wrap all posted code in code tags.
Results 1 to 9 of 9