| Author |
import java.util.* ?!!
|
soumya ravindranath
Ranch Hand
Joined: Jan 26, 2001
Posts: 300
|
|
Hi, I just noticed this unexpected behaviour on my system. If I have compilation fails with 'cannot resolve symbol' error for HashSet constructor. It even said - TestHashSet.java:27: incompatible types found : HashSet required: java.util.Set Set s = new HashSet(); ^ TestHashSet.java:28: cannot resolve symbol symbol : constructor HashSet (java.util.Set) location: class HashSet Set hash = new HashSet(s); Compilation succeeds only if I do individual imports for Set and HashSet ( I tried for ArrayList, List, Collection too ). What am I missing ?! thanks, Soumya.
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Works fine for me. I'd double check your import statement.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24040
|
|
|
You have defined your own class named "HashSet", and it's on your class path. Even if you've deleted the source code, the .class file is hiding somewhere. Find it, and delete it.
|
[Jess in Action][AskingGoodQuestions]
|
 |
soumya ravindranath
Ranch Hand
Joined: Jan 26, 2001
Posts: 300
|
|
and you are God! ( I did have it from some previous experiment )
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24040
|
|
|
I just recognized this symptom from helping other people in the past. This happens to people more often than you would think! Glad I could help.
|
 |
jin sun
Ranch Hand
Joined: Feb 16, 2005
Posts: 30
|
|
|
haha yea that happens to me a lot.
|
 |
Timmy Marks
Ranch Hand
Joined: Dec 01, 2003
Posts: 226
|
|
|
Once again, someone is bitten by using the default package!!!
|
 |
 |
|
|
subject: import java.util.* ?!!
|
|
|