• Post Reply Bookmark Topic Watch Topic
  • New Topic

LinkedList question  RSS feed

 
Jefferey Stevens
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I need to test the methods in this code. In the Main method I need to create a list of strings of however many I want, ex 5, and then test the methods in the code provided, except the iterator one. I also need to be able to print the list, iteratively somehow? I just can't figure out how to start the main, would someone be able to give me an example of how to test one of the methods? I could probably figure the rest out then. Thanks!



I also posted here, http://www.java-forums.org/new-java/83655-linkedlist-question.html#post362584
 
Campbell Ritchie
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have removed a lot of blank lines from your code. there is no need for blanks after every line; in fact I think that makes the code harder to read.
Actually I would move the main method out of that class altogether. Put it into another class, maybe ListDemoyou should add lots more code to the start method, to demonstrate your List working. If you are not familiar with command‑line arguments, start here. You can run it like this:-
javac ListDemo java
java ListDemo Campbell is no help at all when you run into trouble
The parameter args now receives a String[] {"Campbell", "is", "no", "help", "at", "all", "when", "you", "run", "into", "trouble}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!