Why do i get this error?

Hi
When i run my code i get this exception,
java.lang.ClassCastException: java.lang.Integer
at has33.main(has33.java:29)
Why is it that i get this exception?
And could some help me so that i doun't get this Exception?
thanks
nicky
import java.io.*;
import java.lang.*;
import java.util.*;
public class has33{
public static void main(String[] args) {
Hashtable ht = new Hashtable();
//Add vector to store results
Vector results = new Vector();
Object value = null;
int keys[] = {1,2,3,4,5,6,7,8,9,10};
//System.out.println(keys);
String values[] = {"ben", "ben", "alex", "alex", "matt","matt", "mum", "mum", "dad", "matt"};
// First, map keys to values in a hashtable
Hashtable hash = new Hashtable();
// the code matches values one by one for each of the keys
for(int i = 0; i < keys.length; i++) {
hash.put(new Integer(keys), values[i]);
// Then we find each value and remove it from the hashtable
for(int j = 0; j < values.length; j++) {
ht = (hash);
value = (values[j]);
Vector v = new Vector();
String token = null;
StringTokenizer st = null;
if( ht.containsValue( value )) {
Enumeration e = ht.keys();
while (e.hasMoreElements()) {
String tempkey = (String)e.nextElement();
String tempvalue = (String)ht.get(tempkey);
if (tempvalue.equals(value)) {
v.add(tempkey);
ht.remove(tempkey);

No i mean to put then strings and Integers in hashtable like this
                         hash.put(new Integer(1), ben);
                         hash.put(new Integer(2), ben);
                         hash.put(new Integer(3), alex);
                         hash.put(new Integer(4), alex);
                         hash.put(new Integer(5), matt);
                         hash.put(new Integer(6), matt);
                         hash.put(new Integer(7), ben);
                         hash.put(new Integer(8), matt);
                         hash.put(new Integer(9), dad);
                                        hash.put(new Integer(10), dad);thanks
nicky

Similar Messages

  • I get missing plug-in error when opening my online bill which is in PDF format. I am using a 2010 Macbook with the latest version of Safari and Adobe suite installed in my computer. Why do I get this error? What should I do?

    I get missing plug-in error when opening my online bill which is in PDF format. I am using a 2010 Macbook with the latest version of Safari and Adobe suite installed in my computer. Why do I get this error? What should I do?

    In relation to my previous inquiry regarding inability to view a pdf file using Safari...
    Is it possible that I can view other online bills from other website but not this particular bill from one specific website?
    Sorry if I missed any important point in this article -->Apple Safari 5.1 and Adobe Reader/Acrobat Advisory
    Thanks again!

  • Why do I get this error message when I open Organizer in Photoshop Elements 11 "Elements Organizer has stopped working"? My only option is to Close Program so I am effectively locked out of my photo catalogue.  I have reinstalled the program to no avail.

    Why do I get this error message when I open Organizer in Photoshop Elements 11 "Elements Organizer has stopped working"? My only option is to Close Program so I am effectively locked out of my photo catalogue. I have tried reinstalling the program but it made no difference to the error message.
    Could someone help please?  Steph

    Hi,
    Please give a try to Photoshop Elements (PSE) knowledge base. steps mentioned on this and see if it works.
    Regards
    Kishan

  • Why do I get this error when trying to use my bluetooth headset as a listening device? There was an error connecting to your audio device. Make sure it is turned on and in range. The audio portion of the program you were using may have to be restarted.

    Why do I get this error when trying to use my bluetooth headset as a listening device? There was an error connecting to your audio device. Make sure it is turned on and in range. The audio portion of the program you were using may have to be restarted.

    I may have already resolved this issue buy removing the device from my computer and re-pairing it. It is currently working just fine.

  • More than maximum 5 filtered album lists trying to register. This will fail,Why i am getting this error when i pick video from Photo library.

    I am able to pick 4 videos from the Photo library in my iPhoneAPP but when i try to pick 5th one it throws an error:
    "More than maximum 5 filtered album lists trying to register. This will fail,Why i am getting this error when i pick video from Photo library."

    Hello Tate r Bulic
    I don't have any idea how to remove this error,can i pick more than 5 videos from the photo library...
    If it's then please help me and gimme idea..Thanks

  • According to my network provider (Amaysim/Optus) Tethering is enabled, so why do I get this error message "to enable personal hotspot on this account, contact OPTUS"

    According to my network provider (Amaysim/Optus) Tethering is enabled, so why do I get this error message "to enable personal hotspot on this account, contact OPTUS"
    Amysim/Optus support can not help.
    I can not check or change any network settings (no APN settings)
    I have synced phone using latest itunes (10.5.3).
    Phone software is up to date (5.0.1).
    Network settings have been reset.
    SIM card has been taken out and put back in.
    Phone has been switched off/on again.
    Another sim card from virgin works ok (hotspot option is visible and can be turned on/off as required)
    The Amaysim/Optus SIM card can be put into another phone (android) and tethering/hotspot works fine.
    Can anyone provide solution to this nightmare?

    I am having the same issue although i have an iphone 5. I have contacted Live connected numerous times an tried everything imaginable to solve the issue. Is it possibly a handset issue? I cant recieve any help from optus as im with live connected, they cant help me and apple keep telling me to contact your carrier ( live connected). Seems to make me want to switch providers pretty shortly..
    please let me know if you can solve your issue and maybe it can help me too..

  • Why am I getting this error?

    Hello,
    I am trying to call my Java class from a JSP page. I am getting this error:
    Generated servlet error:
    C:\Program Files\Apache Tomcat 4.0\work\Standalone\localhost\em\jsp\Test_0005fSummarySBU_0005fscreen$jsp.java:82: Wrong number of arguments in constructor.
    strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
    I don't understand why I am getting this error as I pass three paramters to the Java class, and I accept three parameters in the constructor.
    JSP:
    <!-- META TAG is necessary to ensure page recompiles--------------->
    <META Http-Equiv="Expires" Content="0">
    <META Http-Equiv="Pragma" Content="no-cache">
    <HTML>
    <!-- The two Java Classes used to build the AlphaBlox query -->
    <%@ page import="com.home.tool.reporting.*" %>
    <%@ page errorPage="run_error.jsp" %>
    <%@ page import="java.util.List,
                     java.util.Collection,
                java.net.URLDecoder" %>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    <TITLE>Economic Model - Summary SBU Report</TITLE>
    <!--Run the onload here, re-retrieve params BM and Breport, pass to onload---------->
    <BODY bgcolor=#ffffff>
    <%
                    Collection strQuery = null;
                    String strEssUser = "test";
                    String strProcessingMonth = "JUL";
                    String strProcessingYear = "2002";
                    strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
                    System.out.println(strQuery);
    %>
    </BODY>
    </HTML>Java class:
    package com.home.tool.reporting;
    import java.net.URL;
    import java.sql.*;
    import java.io.*;
    import java.util.*;
    public class ListReturn extends ReportQueryBuilder
            public void ListReturn()
            public Collection ListReturn(String userID, String pMonth, String pYear)
                throws ReportQueryBuilderException
                //declare Collection store Value-Object pairs
                Collection c = new ArrayList();
                //declare and initialize variables
                CallableStatement cs = null;
                ResultSet rs = null;
                // declare call for stored procedure to pass in three parameters
                String pass = "{Call dbo.p_rep_srSbuList(?, ?, ?)}";
                try
                    //open CallableStatement using JDBC connection to SQL database
                    cs = con.prepareCall(pass);
                    //set IN parameters
                    cs.setString(1, userID);
                    cs.setString(2, pMonth);
                    cs.setString(3, pYear);
                    //execute call and return result set
                    rs = cs.executeQuery();
                    //loop through result set storing each record as a Value-Object pair
                    while(rs.next())
                        c.add(new ListBoxValueObjects(rs.getString(1), rs.getString(2)));
                catch (SQLException sqle)
              throw new ReportQueryBuilderException(replaceToken("Problems executing query: "+sqle.getMessage(), "'", "\\'"));
                finally
                    try
                        //close the Result Set and CallableStatement
                        rs.close();
                        cs.close();
                    catch(Exception e)
                        System.out.print("\nFATAL   : " + e);
                        System.out.print("\nFATAL   : " + e);
                return c;
    }Does anyone see whay I am getting this error??
    I can't figure out the problem!

    change this:
    <%
         Collection strQuery = null;
         String strEssUser = "test";
         String strProcessingMonth = "JUL";
         String strProcessingYear = "2002";
         strQuery=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
         System.out.println(strQuery);
    %>To this:
    <%
         Collection strQuery=null;
         String strEssUser="test";
         String strProcessingMonth="JUL";
         String strProcessingYear="2002";
         lr=new ListReturn(strEssUser, strProcessingMonth, strProcessingYear);
         System.out.println(lr.getQuery())
    %>Then make a new public method in your Java called getQuery()
    public Collection getQuery();Do what you need to do to process it and return the value in getQuery. You will also probably need to make private variables in you declaration to do the processing on.

  • Why am i getting this error? they are not the same?

    1021: Duplicate function definition.
    1021: Duplicate function definition.
    stop();
    import flash.events.MouseEvent;
    // home button definition \\
    // Portfolio button definition \\
    Portfolio_btn.addEventListener(MouseEvent.CLICK, pClick);
    function pClick(event:MouseEvent):void{
        gotoAndStop("getPortfolio");
    // Contact Me button defintion \\
    Contact_btn.addEventListener(MouseEvent.CLICK, cClick);
    function cClick(event:MouseEvent):void{
        gotoAndPlay("contactme");
    why am i getting this error the functions have different names... idk what to do they are for two different buttons I am using action script 3.0

    i did what u said and it said these two lines were the same
    // Portfolio button definition \\
    Portfolio_btn.addEventListener(MouseEvent.CLICK, pClick);
    function pClick(event:MouseEvent):void{                                                         <--------this one
        gotoAndStop("getPortfolio");
    // Contact Me button defintion \\
    Contact_btn.addEventListener(MouseEvent.CLICK, cClick);
    function cClick(event:MouseEvent):void{                                                           <--------and this one
        gotoAndPlay("contactme");
    it gave me the same error but they are not the same

  • Why am I getting this error message......."Adobe Reader could not open 'SBA 413.pdf' because it is e

    why am I getting this error message when I try to open a PDF file?  Adobe Reader could not open 'SBA 413.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

    It's difficult for anyone to say how to fix it. Try getting a new copy of it. Did you download it from a web site, as an email attachment, or something else?
    I donwloaded that form from the SBA web site and it worked fine for me. It is an XFA form created in LiveCycle Designer, but those should work fine with the desktop versions of Adobe Reader. So try downloading it: http://www.sba.gov/sites/default/files/SBA%20413_0.pdf

  • Why am I getting this error message when I try to import? "The following files were not imported because they could not be read. (645)" I can see them :(

    Why am I getting this error message when I try to import? "The following files were not imported because they could not be read. (645)" I can see them
    Is was working this morning!

    Depends on your operating system
    Go to google, try typing in
    Change permissions Windows
    or
    Change permissions Mac

  • Your message was not sent. Tap "try again" to send this message. Why do i get this error?

    your message was not sent. Tap "try again" to send this message. Why do i get this error?

    Hi babychriss,
    Thanks for visiting Apple Support Communities.
    There are several possible reasons why a message might not send. I'd recommend starting with the troubleshooting steps in this article:
    iOS: Troubleshooting Messages
    http://support.apple.com/kb/ts2755
    Regards,
    Jeremy

  • When I want to scroll through My picks why do I get this Error message (A necessary data reference could not be resolved."

    When I want to scroll through My pictures  why do I get this Error message (A necessary data reference could not be resolved)

    Before anyone can help, they need information to work with. Basic stuff:
    - What version of iPhoto.
    - What version of the Operating System.
    - Details. What were you doing when the problem arose?
    - Did it ever work properly?
    - Are there error messages?
    - What steps have you tried already to solve the issue.
    Anything else you can think of that might allow someone else to understand your issue.
    With this kind of information somebody can develop a starting point for troubleshooting the issue.
    Posts that consist of "iPhoto doesn't work. Help" or "iPhoto won't print" or "Suddenly I have no photos!!!!!!!!!!" mean that any helper is simply guessing. With information, s/he may be able to get your issue resolved sooner.

  • GetLastError: 1392 - why do I get this error message when I try to uninstall Acrobat XI Pro?

    GetLastError: 1392 - why do I get this error message when I try to uninstall Acrobat XI Pro?

    Hi uckldag,
    Please try uninstalling using Acrobat Cleaner tool ( Download Adobe Reader and Acrobat Cleaner Tool - Adobe Labs ) and check.
    Regards,
    Rave

  • Why do I get this Error Code:6

    Why do I get this Error Code:6 When I try to open my CC Photoshop CS5?
    I uninstall and I reinstall the product,But this problem continues occurs.Why?

    Run CC Cleaner and try to install again
    CS Cleaner Tool for installation problems | CCM, CS6, CS5.5, CS5, CS4, CS3
      http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html

  • Why do I get this error when I want to run a test using Ant?

    Why do I get this error when I run the Ant build file?
    Testsuite: JUnit
    Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec
    Caused an ERROR
    JUnit
    java.lang.ClassNotFoundException: JUnit
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:280)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:242)
    at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32)
    at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423)
    at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)

    Abder-Rahman wrote:
    In the "XML" file, I was giving the name of the test as JUnit ---> <test name="JUnit">Well, do you have a class called just "JUnit" that contains a test?

  • Why i am getting this error:205 while downloading creative cloud

    why i am getting this error:205 while downloading creative cloud?

    Please check the points and steps below:
    Computer should be on Home network.
    Disable the firewall.
    Reset internet explorer & disabled add ons.
    Disable any Anti-Virus installed on the machine.
    Try in Safe mode in case of Windows & root user for Mac.
    -Ankit

Maybe you are looking for

  • How do I relink clips from a AAF import to original camera media?

    Our current workflow is to import our camera master QTs into Media Composer.  And to then import our production audio WAV files.  These Master Clips, both video and audio, are left as is and not renamed.  We then Autosync them into subclips.  The syn

  • Upgrade from 2012 to 2012 R2 just quits

    Hello, We have the task to upgrade a physical server HP DL360 G6. It is running Windows 2012 Datacenter with Hyper-V role and the target is to do in-place upgrade to Windows 2012 R2 Datacenter. The DVD burned with official 2012 R2 .iso is inserted in

  • Red TYPE statement in ABAP

    has anyone seen this format in ECC 5.0 ... TYPE pernr#TYPE pa0000-pernr. "Personnel number In the editor it is displayed in red. many thanks, john

  • [SOLVED]Not render menuList in menu3 facet if no items

    JDev 10.1.3.2.0 ADF BC/ADF Faces panelPage I'm using the MenuModel to build my menus. Some pages will not have a startDepth of 2 menu items. If no items, I do not want to render menuList in the menu3 facet. I can't figure out what expression to place

  • Is there a way to display all the image files(jpeg, png, �) present in the

    Description: Currently I am using �Sun Java� Wireless Toolkit 2.5 for CLDC, Beta 2 � toolkit for developing J2ME applications. I am using the �javax.microedition.amms.control.imageeffect� package(JSR 234) for adding effects like red eye, border, etc.