Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes HashSet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "HashSet" Watch "HashSet" New topic
Author

HashSet

Jayaram Subramanian
Greenhorn

Joined: Aug 12, 2008
Posts: 7

The code is not compiling and giving identifier expected. Where am i going wrong?
Gamini Sirisena
Ranch Hand

Joined: Aug 05, 2008
Posts: 347
The last few statements seems to be floating around. Try putting them in to the main method.

It would also help if you posted the error output..
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3826

There are few errors in your code.
First the part,



should be inside a normal method or in the main method (not everything in that but as you trying to test your class it's better be in the main method).

Constructor for the SetTest(String) is not defined. Instead you have,


which is considered a normal method, happen to have the class name. It should be


And,


is wrong, since you can't add String to a set which is defined to have objects of SetTest.


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
 
subject: HashSet