• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Interesting Problem?

 
Sumeet Gaikwad
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Here is my method

public java.util.List sortHashKeys(java.util.Hashtable hash){
java.util.List l = new java.util.ArrayList();
java.util.Enumeration enum = hash.keys();
while(enum.hasMoreElements()){
l.add(enum.nextElement());
}
java.util.Collections.sort(l);
return l;
}

If I use this method in another class (which is not Applet) it works fine.
But if I use this method in the Applet it gives me ClassCastException.
If I comment the Line
]java.util.Collections.sort(l);

then it works without exception.
I am not getting what the problem using theCollections.sort(l); method in Applet.
Any clues??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic