• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

LinkedList question

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
Posts: 75718
  • 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}
My pie came with a little toothpic holding up this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss
    Bookmark Topic Watch Topic
  • New Topic