Bookmark Topic Watch Topic
  • New Topic

regarding Objects and collections  RSS feed

 
suresh sai
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Report post to moderator
hi,
the following code gives ClassCastException.

Object myObjects={new String("foo"),new Boolean(true),new Integer(5)};
Arrays.sort(myobjects);

Is it because of ,myObjects contain different type of objects or it is due to..Object is super class of Arrays.Please tellme ,How can I rectify the error?
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please don't post the same question in multiple forums. It creates duplicate conversations and wastes the time of the people trying to help you.

Thanks,
Dave
 
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!