Why do i get classcast exception for this code
import java.util.*;
public class Test1{
public static void main(String a[]){
Set s = new TreeSet();
s.add(new Person(20));
s.add(new Person(10));
System.out.println(s);
class Person{
Person(int i){}
}
basically classcast exception is thrown when the class can not be casted with the proper form that is demanded.
1> in case of set the value should be mutually comparable. but unfortunately in you code you have not implemented comparable interface. you should implement that interface.
2> after using the comparable interface you should implement the method <class object 1>.compateTo(<class object 2>)
the above two process should exclude the exception from you code hopefully.
check out!
Similar Messages
-
In Firefox 4.0 I have a server ... it contains a self signed certificate. Using IPv6 I can not add a "Security Exception" for this certificate.
1. I log onto the server (using IPv6). I get the "Untrusted connection page" saying "This connection is Untrusted"
2. I click on "Add Exception.." under the "I understand the Risks" section.
3. The "Add Security Exception" dialog comes up. soon after the dialog comes up I get an additional "Alert" dialog saying
An exception occured during connection to xxxxxxxxx.
Peer's certificate issuer has been marked as not trusted by the User.
(Error code sec_error_untrusted_issuer).
Please note that this works in Firefox 3.6.16 (in IPv4 and IPv6). It also works in Firefox 4.0 in IPv4 only IPv6 has an issue. What's wrong?Exactly the same problem, except I'm using FF v6 for Windows, not FF v4 as for the lead post. This is for a self-cert which IS trusted, although the error message says it isn't.
-
HT201359 Why am I getting billed twice for a song download
Why am I getting billed twice for a song download
If you are being charged double the listed price then you can contact iTunes Support via this page : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption (if you are downloading the song twice then in some countries you will be charged again as redownloading is not currently possible in all countries).
Or are adding or changing credit card details on your iTunes account ? If you are then each time that you do so a small temporary store holding charge ($1 or the approximate local equivalent) may be applied to check that the card details are correct and valid and that it's registered to exactly the same name and address as on your iTunes account - it should disappear off your account within a few days or so.
Store holding charge : http://support.apple.com/kb/HT3702 -
Why am I getting billed twice for the same thing
I ordered 9 songs off of Itunes on 12/29/12 and my visa was billed $10.50 an email was sent to me confirming this.
today (1/2/13) I was sent another email billing my visa for $7.32 for 6 of the same songs I ordered on 12/29/12.
Why am I getting billed twice for these songs.This a user to user forum. We don't know why you where billed twice. Please navigate to the Contact Us link at the bottom of this page and contact Apple. They will be better suited to answer your question.
Regards -
I work for the County and we purchased a copy of Adobe Photoshop CS2 long ago. The person that did the order is no longer here. All I have is the CD Disk that is new but i did not know the key code is. Is there a way to get the keycode for this?
It would not work anyway. The activation servers have been retired and Adobe has provided a new CS2 download along with a new serial number for CS2 owners.
Download Acrobat 7 and CS2 products
Gene -
I've a problem which is: Ibelieve there's someone who knows my password in some games like "Happy Day" so, could you please help me by not letting anybody to use this game except for this IMEI 01 336000 521261 1 even if they have the correct password. Thanks alot for your help.
Change your password.
These are user forums. We can't do what you ask, in fact no one can. -
I have an old apple desktop that needs an OS. Where can I get an OS for this that mac?
What type on machine is it?
-
CS4 won't start up on my new computer. The error message I get is "Licensing for this product has stopped working." Both the old and new computer are MACs and the error code I get is 150:30. It says to restart the computer or open another application in the suite, but neither helps. It says if nothing helps to contact Adobe support, but this is the only way I'm given to contact adobe support. Can I really not use my purchased software on my new computer? What do I do to activate the license on the new computer?
"Licensing For This Product Has Stopped Working" - Help
-
Itunes 11.4.0.18 crashing when clicking on app store
Itunes is getting crash when clicked on app store. I tried to get some information for this crash and got the above message in debugging mode. Please fix this if required but i am unable to open app store.Click here and follow the instructions to change the iTunes Store country.
(97125) -
I have license for Adobe Design Std CS6 6.0 MLP .Is there any way to get the installer for this?
Download CS6 products
Mylenium -
I can't get passbook to accept my loyalty cards. It keeps saying no pass available for this code. What am I doing wrong?
You may have installed your TextWrangler application without administrator privileges. In this you'll have to look for the twdiff file in the Local Applications Support Folder (refer to TextWrangler User Manual).
To fix your problem with Dreamweaver, while selecting your File Compare tool, try looking for the twdiff file in the following location :
Macintosh HD:usr:local:bin:twdiff
That should definitely work. It did for me
Cheers! -
How can i get a solution for this message "Your Apple ID has been disabled"?
How can i get a solution for this message "Your Apple ID has been disabled"?
Contact iTunes Store support. That message can mean one of several things:
Your credit card on file has expired
The credit card issuer has denied a charge
Your account has been hacked
Key information in your account has changed, and Apple needs to contact you to confirm the change. -
HT4623 i have iOS 4.2.1 in 3G old one. how to get the applications for this iOS
i have iOS 4.2.1 in 3G old one. how to get the applications for this iOS
look at this thread
https://discussions.apple.com/message/22837309#22837309 -
I recently saved a draft email using mail, but now whenever I try to reopen it, it says loading but will not load. All my other drafts load fine except for this one. Is there a way to access the draft outside of mail?
Create a new profile as a test to check if your current profile is causing the problems. <br>
See '''Creating a profile''':
*https://support.mozilla.org/kb/profile-manager-create-and-remove-firefox-profiles
*http://kb.mozillazine.org/Standard_diagnostic_-_Firefox#Profile_issues
If the new profile works then you can transfer files from a previously used profile to the new profile, but be cautious not to copy corrupted files to avoid carrying over the problem <br>
'''Profile Backup and Restore'''
*http://kb.mozillazine.org/Profile_backup
*https://support.mozilla.org/en-US/kb/back-and-restore-information-firefox-profiles
*http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox -
Why did I get charged again for items I have already purchased?
Why did I get charged again for items I have already purchased?
My theory is that because the original appleID wasn't an email, they're making you switch to it when you update to iOS5. So that creates essentially a new appleID and it isn't recognized as the one that originally made all your purchases. Sign out of the Store and then sign in using your old ID and it should do the trick.
The other alternative is to sync your apps rather than reinstalling them....if you can. Hope the phone service helps.
Maybe you are looking for
-
How do i consolidate multiple user accounts into one
I have inadvertantly created three very similarly named user accounts. Can I merge them into one?
-
How to create different users in the same iPad 4?
I would like to share my new iPad with other person. How can I create two users.?
-
Asset (Machine) Transfer with in Company code (Different Business area)
Dear all Please provide us transaction code and document flow for inter plant transfer of assets t. All required entry of MM, PM, FI and excise should be covered in the document process. Inter u2013plant & inter-company assets transfer/sale is common
-
PI 7.1 - Message Monitoring - Adapter Engine (Database Overview)
Hi Friends, In Message Monitoring --> Adapter Engine --> Database (Overview) is not working. It throws the following error message. no_connection Exception Message: RemoteException in Method: CentralViewManager: getIProfiles( IApplication, boolean ).
-
How to check if file and printer sharing is on or off
Hi, i want to evaluate if the windows file and printer-sharing is turned on or not with a script. With regshot i found out that the DLL hgclp.dll is involved but not which registry-entry is the one set.