Trying to solve the hashtable problem;

this is a test of a part of my programming, trying to solve the hashtable
i took out the erronous part and change some of it.i'm trying to print out a table of data with 4 column
import java.util.*;
public class test {
     // creating a global hashtable name "b" its
     //static just for the convieniet of it
static Hashtable b = new Hashtable();
public static void addItem(String keyid, String t, double p, int q){
// array size of 4 for my value in hashtable "b"
String [] array = new String [4];
// puting all my variables into string array
//including my keyid as the first in array[0]      
     array[0]=keyid;
     array[1]=t;
     array[2]= String.valueOf(p);//casting of double type to string
     array[3]= String.valueOf(q);//casting of int type to string
     b.put(id,array);//setting key = id and value = my array[]
public static void main (String args[]) throws Exception {
     String numb = "009", piss="theone";
     double cost = 19.50;
     int a = 1;
     String [] testItem;
     addItem(numb,piss,cost,a); //call of method additem;
     Enumeration e = b.keys();
// Get all values
while ( e.hasMoreElements())
{            tempItem = (String [])e.nextElement(); **// error msg here**
     System.out.println("array element 1"+tempItem[1]);
     System.out.println("array element 2"+tempItem[2]);
     System.out.println("array element 3"+tempItem[3]);
this is my error msg "ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;"
1 =====>cannot find symbol
symbol  : variable id
location: class test
        b.put(id,array);//setting key = id and value = my array[]
2 ===>cannot find symbol
symbol : variable tempItem
location: class test
tempItem = (String [])e.nextElement();
3 ====>cannot find symbol
symbol : variable tempItem
location: class test
System.out.println("array element 1"+tempItem[1]);
is there anyway to solve this or anyone can provide me with an alternative way of printing a table with 4 col?

you should learn to post your code inside code tags
mangotree wrote:
1 =====>cannot find symbol
symbol : variable id
location: class test
b.put(id,array);//setting key = id and value = my array[]there is nothing called "id"
mangotree wrote:
2 ===>cannot find symbol
symbol : variable tempItem
location: class test
tempItem = (String [])e.nextElement();
3 ====>cannot find symbol
symbol : variable tempItem
location: class test
System.out.println("array element 1"+tempItem[1]);there is nothing called "tempItem"
mangotree wrote:
this is my error msg "ClassCastException: java.lang.String cannot be cast to [Ljava.lang.String;"
here you are iterating through the keys of the hash table ("b.keys()"), and your key is a String, not a String[; perhaps you want the value instead?

Similar Messages

  • How to solve the setColor() problem with multithreading?

    My fractal program uses a custom number of threads to draw the complete image. If I use just 1 thread, the image looks clean, if I use more threads some pixels of the image gets other colors. The problem ist the painting code:
    g2d.setColor(col);
    g2d.drawLine(x, y, x, y);as it is necessary to first set the color of the graphics object and then draw the line. I can solve this pixel color problem by synchronizing the Graphics2D object:
    synchronized (g2d) {
      g2d.setColor(col);
      g2d.drawLine(x, y, x, y);
    }but this slows the code down to times where just 1 thread is calculating the image. Unfortunately, I can't find a draw() method that has a color parameter.
    I tried to divide the panel into multiple BufferedImages (1 for each thread) which solves the pixel problem but only the first BufferedImage get's drawn.

    I solved my problem now. My solution is to use a separate BufferedImage for each Thread. I still had a bug where i didn't transformed the x/y coordinates of the complete image to the shifted x/y coordinates of the single BufferedImages, so that the threads draw the image out of the visible area which looked like all threads after the first only had a black image. After adjusting teh coordinates, the fractal now gets drawn correctly. And boy it's much faster with multiple threads - even on single core systems. On a dual core system, using 10-20 threads about doubles the performance as both cores have work almost all the time until the fractal is finished. :-)

  • When apple will solve the wifi problem ?

    when apple will solve the wifi problem ?

    They keep trying, but haven't yet in all the time OS X has existed. Every version of OS X has had some WiFi issue with some group of users. The normal pattern is they release a fix for one group, and another group develops a new WiFi problem.

  • I bought iphone 4 in US and i and other person not able to listen properly because on the time of conversation voice cracking and difficult to understand each others.so i would like to request you that please solve the above problem.i love my iphone.

    Sir,
    I bought iphone 4 in US.last 6 month me and other person not able to listen properly the voice because the voice is cracking.i have called earlier about the above problem and they said to upload the new verson 6.1.3 and it will be done but after loading this version still i am facing the same problem.so ,i would like to request you that please solve the above problem as soon as you can.I will be thankful to you.i love my apple Iphone.
    waiting for your earliest reply.
    thanks
    Rajeev Gupta

    Hello sir
    As you know about my iPhone 4 which has a problem of voice cracking so I would like to replace to other phone like IPhone 5s.I will pay the replacement charges immediately.i am reaching miami on 19th of janvary 2014 so I would like to request you please arrange my appointment on the Apple store,dadeland mall ,miami at 15.00pm as I will reach miami at 13.00pm and my flight to India at 19.00pm.
    Last time you told to replace at miami on 26th of September but without oppoimtment they have not entertained me.so I would like to request you that please arrange my appointment this time
    I will be thankful to you
    Rajeev Gupta

  • How do I solve the memory problem ( 5 beeps ) upon startup?

    hp compaq d530SFF,  how do I solve the memory problem (5 beeps ) upon start up?

    Hi:
    You already know the answer to that! 
    http://h30434.www3.hp.com/t5/Desktop-Lockups-Freezes-Hangs/when-I-try-to-boot-up-lighs-flash-red-and...
    Paul

  • Will the next IOS update 5.0.2 solve the batter problem of my iphone 4s?

    will the next IOS update 5.0.2 solve the batter problem of my iphone 4s?

    Let me check my Magic Eight Ball..... All signs point to "Yes"
    All kidding aside, We all hope so!!

  • Trying to solve an unknown problem on my computer.

    I am currently trying to solve a problem that has screwed up many of my applications. iMovie, Windows Media Player, and AOL Instant Messanger on my computer are all malfunctioning for an unknown reason.
    I am not sure if this is the problem, but when this problem first began, I was using applications at the time called Sound Studio and Amadeus, which were sound recorder applications. I had set the microphone to line-in when I was transferring audio cassettes to mp3s. Later in the day, I noticed other applications were not working right.
    When I open, iMovie, and it loads a saved project, the loading bar will not move and all of these clips (Clip 01 to Clip 244.dv) will appear in the trash as iMovie document files. These files are Zero KB and do not even exist before I load the application. Then iMovie will finally be finished opening and I usually use it to import from my digital camcorder. It will detect it, however when I click on Import, it will load the import for about a second and then the button goes back to white, like I never clicked it at all. Also, when I click on play, it will detect that the camera is playing but the clip never appears on the iMovie screen, it stays on the "camera playing" blue screen. The clip on the camcorder is playing just fine. I can import existing files from my hard drive just fine however.
    With AOL Instant Messenger, it still works fine, but I have noticed that a few of the sounds are gone.
    With Windows Media Player 9 for OS X, whenever I tried loading a windows media file, it would tell me that it was compressed by using a codec that is not supported. The files have worked just fine until now.
    I had set the system preferences back to default before using any sound recorder applications, but it made no difference. I have tried re-installing all of these applications but that made no difference. Also, I ran virus scans with Virex 7 and ClamXav but no virus were found. Does anyone know what is causing all of this to happen?

    Try using Disk Utility to repair your startup disk (hard drive) as shown in Dr.Smokes Resolving Disk, Permission, and Cache Corruption. You may have some directory corruption.
    Most Mac users are using Flip4Mac as Windows Media Player is no longer supported by Microsoft for Macs. Fip4Mac runs those files thru QuickTime.
    Cheers!
    DALE

  • TS1559 WIFI solutions proposed by Apple are not working. Does oneone how to solve the WIFI problems?

    Dear Apple.
    I was really happy with my iphone4s, IOS 6.0, great product amazing quality and posibilities BUT.......
    I updated from IOS 6.0 to 6.1.1. and the WIFI nightmare started.
    I waited for a new update to fix the WIFI problems and I updated my iphone 4s from 6.1.1. to 6.1.2. in order to solve these problems related with WIFI connections.
    But IOS 6.1.2. is even worst:
    - WIFI is not working at all. So I cannot download apps greater than 50MB.
    - Battery life is shorter than ever.
    - 3G goes in and out every minute.
    - When you operate the iphone4s you can realize that is hotter than before.
    These problems are unnaceptable and inconsistent with a high quality standard product.
    You can read a lot of blogs, I am not the only one.
    Please give us a solution as soon as possible.
    Best Regards
    AICITEL

    Thank you for your support.
    My router is a TL-WR740N, and I think it has only a 2.4-2.4835GHz antenna.
    So it seems that I have to keep on trying.
    I also tryed to rename the router, still nothing.
    Thank you anyway.
    FYI.
    4 puertos LAN de 10/100Mbps
    1 puerto WAN 10/100Mbps
    Botón
    Botón de configuración rápida de seguridad
    Botón de reinicio
    Suministro de Energía Externa
    9VDC / 0.6A
    Estándares Inalámbricos
    IEEE 802.11n*, IEEE 802.11g, IEEE 802.11b
    Antena
    omnidireccional fijo de 5dBi
    Dimensiones (Largo x Ancho x Alto)
    6.9 x 4.6 x 1.3 in. (174 x 118 x 33 mm)
    Frecuencia
    2.4-2.4835GHz
    Velocidad de Señal
    11n: Hasta 150Mbps (dinámico)
    11g: hasta 54Mbps (dinámico)
    11b: hasta 11Mbps (dinámico)
    EIRP
    <20dBm(EIRP)
    Sensibilidad de Recepción
    130M: -68dBm@10% PER
    108M: -68dBm@10% PER
    54M: -68dBm@10% PER
    11M: -85dBm@8% PER
    6M: -88dBm@10% PER
    1M: -90dBm@8% PER
    Funciones Inalámbricas
    Activar / Desactivar radio inalámbrica, WDS Bridge, WMM, estadísticas inalámbricas
    Seguridad Inalámbrica
    64/128/152-bit WEP / WPA / WPA2,WPA-PSK / WPA2-PSK
    Tipo WAN
    IP dinámica / IP estática / PPPoE /
    PPTP (Acceso dual) / L2TP (Acceso dual) / BigPond
    DHCP
    Servidor, cliente, lista de cliente DHCP,
    Reserva de dirección
    Calidad de Servicio
    WMM, Control de Ancho de Banda
    Redireccionamiento de Puertos
    servidor virtual, Port Triggering, UPnP, DMZ
    DNS Dinámico
    DynDns, Comexe, NO-IP
    Puerto de Transferencia VPN
    PPTP, L2TP, IPSec (ESP Head)
    Control de Acceso
    Control Parental, Control de Manejo Local, Lista de anfitriones, la Lista de acceso, manejo de reglas
    Seguridad Firewall (cortafuegos)
    DoS, SPI Firewall
    Dirección IP Filtro / Filtro de dirección MAC / filtro de dominio
    Conexiones de direcciones IP y MAC
    Management
    Control de acceso
    Manejo Local
    Manejo remoto
    Certificación
    CE, FCC, RoHS
    Contenido del Paquete
    TL-WR740N
    1 fijo antenas omnidireccionales
    Fuente de alimentación
    CD de recursos
    Guía de instalación rápida
    Requisitos del Sistema
    Microsoft ® Windows ® 98SE, NT, 2000, XP, Vista ™ o Windows 7, Mac ® OS, NetWare ®, UNIX ® o Linux.
    Ambiente
    Temperatura de funcionamiento: 0¿ ~ 40¿ (32¿ ~ 104¿)
    Temperatura de almacenamiento: -40¿ ~ 70¿ (-40¿ ~ 158¿)
    Humedad de funcionamiento: 10% ~ 90% sin condensación
    Humedad de almacenamiento: 5% ~ 90% sin condensación

  • How to solve the certificate problems in Java Web Start

    Hi, All,
    I encounted these two problems recently:
    (1) I have an application which is supposed to be started by Java Web Start. I have written my own code which calls other .jar files from other companies. Since for web start, you need to sign all .jar files if you want more permssions. Now I got the following problem:
    '=================================
    An error occurred while launching/running the application.
    Title: My stuff
    Vendor: UCLA
    Category: Launch File Error
    JAR resources in JNLP file are not signed by same certificate
    =================================
    How to go around this? It seems that the .jar files from that company has been signed already. Then I tried to uncompress those jars and re-archieve again, then sign it again using the keystore I used to sign my own .jar files. It still does not work. Any help on this will be appreciated!
    (2) Afterr I signed a .jar file, when I want to run it again, using command: java -jar abc.jar
    It does not work any more, I am not sure whether it will become a problem if loaded by Web start.
    Thanks a lot!
    David

    In another forum answer, a user named Dietz suggested the following:
    If you have a library signed by another signer, you need to factor it out into a seperate extension jnlp file.
    AJones0131

  • How to solve the footer problem?

    In germany since the beginning of 2007 all business emails must be stamped by a company footer.
    This sounds simple [Outgoing Content filter, add-footer ] but in reality it is a big problem, because most of users don't want to have a the company footer at the end of the email if they are sending a reply.
    They expect the footer at the end of the new part they have written.
    So the solution can be to use hard coded placeholder generated by the initial email system that is replaced by Ironport with the footer (depending on the company the user is a member of, different footers can be used e.g. by a ldap group query.)
    :?: But ... How to replace the placeholder? It seem that this is not possible with Ironport or does anybody has an idea?
    :idea: Another way to solve the problem can be to use a "Stamping header" instead of a footer. Such a header will be always at the top of the new part of an email, when you send a reply.
    I asked support, it will be added to the wishlist for new releases.
    So so far this is not a solution or does anybody know a workaround?
    Regards
    Stefan

    In germany since the beginning of 2007 all business emails must be stamped by a company footer.
    This sounds simple [Outgoing Content filter, add-footer ] but in reality it is a big problem, because most of users don't want to have a the company footer at the end of the email if they are sending a reply.
    They expect the footer at the end of the new part they have written.
    So the solution can be to use hard coded placeholder generated by the initial email system that is replaced by Ironport with the footer (depending on the company the user is a member of, different footers can be used e.g. by a ldap group query.)
    :?: But ... How to replace the placeholder? It seem that this is not possible with Ironport or does anybody has an idea?
    :idea: Another way to solve the problem can be to use a "Stamping header" instead of a footer. Such a header will be always at the top of the new part of an email, when you send a reply.
    I asked support, it will be added to the wishlist for new releases.
    So so far this is not a solution or does anybody know a workaround?
    Regards
    Stefan
    Hello Stefan,
    we have the same problem and found the best solution to do is to have company rules that apply on the client side.
    This decission is based on the fact that already many companies use client based signatures (s-mime) and also client based encryption which makes a gateway solution impossible.
    We found a nice solution for exchange/outlook based on group policies
    Aas we are almost neighbours you are invited to visit us.
    Greetings from Greven/Münster

  • How to solve the OB problem of 'Raw Materials' account in Trial Balance?

    Dear Friends,
    In a 'Perpetual Inventory' system how to show the opening balance of Inventory Account in Trial balance as other account's opening balance?
    You can check this out with some opening balances entered for GL Accounts (from Administration -> system initialization -> opening balance) and some initial quantity of inventory items entered (in inventory transactions) on - let's say a company's starting date 1-1-06.

    Hi Gordon,
    My SBO version is 8.8 PL 10, Indian Database. I want to see the "Raw Material" G/L Account's opening balance in the Opening Balance Column of Trial Balance or similar report of SBO. The technical problem behind this is - the mentioned reports shows the the amounts in OB column if that amount is entered by the OB Transactions (in Administration -> System Initialization). But how to manage the Raw Material / Inventory G/L through this concept, as the OB amount for this is entered through Inventory Initial Quantity. We can do the entry one day before the expected starting date of the financial period, is that can be a standard practice? For. e.g. entering the opening balance for 1-1-06 on 31-12-05.

  • I cannot activate icloud foto. When I click on icloud the window comes up but in seconds the possibility to click to activate foto freezes. Can anyone help. I have spent so many hours trying to solve the problem.

    i am so tired. Have used many hours now to find a way to get my fotos from my Iphone to my PC'er (windows 7). I have downloaded Icloud, but I cannot aktivate "foto" When I click on icloud there comes a window, where it seems that I can click on foto. But within sekonds the 3. (foto) possibility freezes and the vindow sort of changes: You can still se the choice "Foto" but it cannot be activated. Can anyone help, please!

    Thanks for the link to your system. 
    You have a Combination BluRay and Surround System that includes WIRELESS Rear Speakers:
    Rear wireless ready: Yes, 5.1ch wireless system included, 7.1ch wireless option with purchase of SH-FX67 + SB-HS100A
    This could account for why the BluRay is generating interference with your wireless network signal.
    You can go thru the process of changing the wireless  channels and other changes to the Verizon Actiontec Router or hook up your old router which was working before you switched to FIOS.
    FIOS has a Superior Product over any cable system and I would hate to see you leave over something that was out of their control. 
    By the way, looking at the picture of the rear connections for your Panasonic you would want to have an Optical Toslink cable go from the back of the Verizon HD Set Top Box (Optical Out) to the Optical In jack on the back of the Panasonic.   This connection will provide you with Dolby Digital sound (If Broadcast by Channel) while you are watching TV.  You may need to switch inputs on the Panasonic Remote to get this to work.  You may also have an Optical Out jack on the TV that could be connect as well if you are using an HDMI Cable.
    Your Verizon STB  would be connected to the TV by either HDMI, Component, Composet, or Coax (Highest Quality to Lowest Quality).  The HDMI would also provide sound to your TV so that it's internal speakers would work if desired.
    If you are the original poster (OP) and your issue is solved, please remember to click the "Solution?" button so that others can more easily find it.
    If anyone has been helpful to you, please show your appreciation by clicking the "Kudos" button.

  • Experience with trying to solve the problems from 2007-001 update

    I am on a C2D iMac running 10.4.8, Airport card connecting to Buffalo Airstation.
    Just to share what I've done yesterday
    1. Did the archive and re-install OS X thing.
    2. Updated firmware up to the point right before 2007-001 update (used ethernet cable to download, otherwise it would have taken forever.)
    Result - connection doesn't drop any more, but wireless transmission speed is really slow.
    3. Went into the Buffalo Airstaion config and changed the wireless channel.
    Result - for about 5 minutes the transmission became as fast as my Core Duo MacBook on wireless (can do ~100kbps on file downloads etc.), and then it became slow again.
    I will continue to try changing the channel sporadically over the next few days, but increasingly I'm starting to feel I shouldn't bother. I'm connecting via ethernet cable now, it's much faster (even when compared to when the wireless connection was at 100%). "All" that I have to live with now is the ugly cable being strewn around the house.
    Be that as it may, I'm still pretty disappointed by the whole experience.

    Hey anoblegee,
    If you are having issues with connecting to your wireless router, then the first thing I would check is the settings on the router to make sure they are using the recommended set up. Take a look at that and also the troubleshooting Wi-Fi articles for both Mac and iOS devices. 
    iOS and OS X: Recommended settings for Wi-Fi routers and access points
    http://support.apple.com/en-us/HT202068
    Wi-Fi: How to troubleshoot Wi-Fi connectivity
    http://support.apple.com/en-us/HT202222
    iOS: Troubleshooting Wi-Fi networks and connections
    http://support.apple.com/en-us/TS1398
    Hope this helps,
    -Norm G. 

  • I want to solve the payment problem - please

    The payment of $9.99 was not taken out of my bank account -- I got a message that there was a problem -- lets solve it. what is the problem

    These are the user forums. In other words, we are mostly users, like yourself, helping each other out here.
    Contact Adobe.
    Contact Customer Care
    1 (800) 833-6687
    Benjamin

  • To solve the sound problem

    i have problem in my computer ,cause this get very slow after open 2 or 3 works

    Hi RashisR,
    Welcome to the HP Forums!
    I would like to take a moment and thank you for using the forum, it is a great place to find answers. For you to have the best experience in the HP forum, I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I am unsure if you are having an issue with your sound or your computer's performance is slow.
    Here is a link to Using Automated Troubleshooting (Windows 8).
    Please select the the correct option and follow the on screen prompts.
    There is  a link on the document for troubleshooting hardware and sound  windows 8.
    I am also including this document . Improving System Performance without Adding Memory (Windows 8).
    If you would like further assistance, please provide your exact model of HP computer and the results from any troubleshooting steps you have done. Please also confirm what Operating System you are running.
    How Do I Find My Model Number or Product Number
    Sparkles1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom right to say “Thanks” for helping!

Maybe you are looking for