Ask your own question, for FREE!
Computer Science 14 Online
OpenStudy (anonymous):

I ran into an error while making a toString method for a linked list of 'a' to 'z'. The result String returned back to the public method only contains 'a' when the result println shows a-z public String toString() { String result = "{"; result = generateList(result, first); result += "}"; return result; } private String generateList(String result, Node first) { result += "," + first.data; System.out.println(result); //tests what result contains at each iteration if(first.next != null) { generateList(result, first.next); } ret

OpenStudy (anonymous):

last part is "return result;" I think the fix to this is to put the return statement of the private method in an else statement, but this results in an error.

OpenStudy (anonymous):

It appears result = generateList(); works..

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
1 day ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
1 day ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!