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...
Type: Posts; User: Norm
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...
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...
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.
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...
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...
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...
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...
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...
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.