• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

List list = new ArrayList()

 
henri henri
Ranch Hand
Posts: 115
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just learned that it is better to use List here in the place of the ArrayList. I would have private List horror = new ArrayList();
When I do this, I get a compiler error for the the last 2 lines of code.
After the List objects are instanstieated, they are filled with Strings and I want to get the size of the ArrayList after filling them.


 
Keith Lynn
Ranch Hand
Posts: 2399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the error?
 
Jeff Albertson
Ranch Hand
Posts: 1780
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should always post a minimal, complete example program demonstrating your problem.
That way, forum members can simple copy, paste, compile and run your code.
As it is know, you didn't even tell us the error! We are left guessing!
And the few lines you posted, depending on where they occur in your code,
may or may not generate syntax errors. Again, learn to be a good forum
member and post short but complete code.

By the way, creating non-static fields like horror but copying its size
to a static field size_horror smells bad. That looks like a mistake in
the making...
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic