• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

LinkedList question

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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}
reply
    Bookmark Topic Watch Topic
  • New Topic