Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Beginning Java and the fly likes help with measuring performance classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "help with measuring performance classes" Watch "help with measuring performance classes" New topic

help with measuring performance classes

Rebecca Plumb

Joined: Dec 09, 2007
Posts: 9
hi,I�m having some problems with my code.

here is the instruction:

Performance Test: Implement a program that measures the performance of ArrayList, Vector, LinkedList by inserting 100,000 Strings and then deleting them one by one. Use a Calendar Object (p. 304) to measure the time in milliseconds. In addition to the screenshots give a table with the results. Bonus: Add sorting to the benchmark. What changes?

This is what I have so far for the Vector class:


Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on token "void", @ expected
Syntax error, insert "enum Identifier" to complete EnumHeader

at Vector.main(

Edit by mw: Added Code Tags.
[ February 06, 2008: Message edited by: marc weber ]

marc weber

Joined: Aug 31, 2004
Posts: 11343

First, I think you're supposed to use the Vector class in the API (java.util.Vector) instead of defining your own Vector class. Writing your own classes with the same name as classes in the API can lead to serious confusion later.

Second, your compilation error seems to be because you're trying to define a method inside the body of another method (getTime inside of main).

Third, there are other problems with braces. I think it would help to be more careful with your indentation and make sure these line up. (I've added Code Tags to your original post so that your indentation shows.)

(It looks like you're using an IDE that's confusing things. I suggest using a simple text editor.)
[ February 06, 2008: Message edited by: marc weber ]

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link:
subject: help with measuring performance classes
It's not a secret anymore!