This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

help with measuring performance classes

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:






ERRORS:

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(Vector.java:6)


Edit by mw: Added Code Tags.
[ February 06, 2008: Message edited by: marc weber ]
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
But how did the elephant get like that? What did you do? I think all we can do now is read this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic