File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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


Jayaram Subramanian

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: 378
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

Joined: Mar 24, 2008
Posts: 3902

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


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

[How to ask questions] [Twitter]
I agree. Here's the link:
subject: HashSet
jQuery in Action, 3rd edition