This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
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


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
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: 3827

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]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HashSet