"int cannot be dereferenced" error.. help me please

I'm working with an array list class called PersonList and it uses attributes from a normal class called Person.
I would like to make this method PrintPerson inside the PersonList class that should search for a specific Person given the ID as parameter to the method. the method should print all info of the Person if found, otherwise a message saying id is not valid.
I solved it like this:
public void PrintPerson(int id)
          System.out.println("Enter ID of the person ");
          id = Stdin.readInteger();
          //search the ID if it is in the List
          int i=0;
          while
          ((i<next)&&(!(list.getID().equals(id))))
          i++;
          //if found
          if (i<next)
               list[i].OutputWindow();}//display the object ouput of this ID
               else{
               System.out.println("The following ID: " id "is not valid!");
          }//end if
     }// end of method
my problem is with this code:
((i<next)&&(!(list.getID().equals(id))))
I get this error "int cannot be dereferenced"
what should I do? help me please
-- Matt

list.getID() == id                                                                                                                                                                                                                               

Similar Messages

  • ERROR: int cannot be dereferenced

    hi everyone i am trying to copmile the following code
    public void refreshGUI() {
            MessageBoardQueries MBQ = new MessageBoardQueries();
            Date date = Calendar.getInstance().getTime();
            DateFormat df = new SimpleDateFormat("dd/MM/yyyy");
            String argDate = df.format(date).toString();
            int pNumber = MBQ.queryPending(argDate);
            int aNumber = MBQ.queryAccepted(argDate);
            int dNumber = MBQ.queryDeclined(argDate);
            pendingNumberField.setText(pNumber.toString());
            acceptedNumberField.setText(MBQ.queryAccepted(argDate));
            declinedNumberField.setText(MBQ.queryDeclined(argDate));
        }but i keep getting the error:
    int cannot be dereferenced on the line
    pendingNumberField.setText(pNumber.toString());
    does anyone know why?

    because int is a primitive datatype, hence doesn't inherit from java.lang.Object, and as such doesn't have a toString method
    try Integer.toString(pNumber) or String.valueOf(pNumber). either is equally valid

  • Int cannot be deffered error

    Hello,
    I hope this is an appropriate forum for this question. This is not a HW assignment; I have just started Java as a hobby. I think the real problem I have is a lack of sound understanding of how to call methods, and what criteria have to be met to call a method within the main().
    Here is the code:
    public class InconvenientChange3
         public static int quarters;
         public static int dimes;
         public static int nickels;
         public static int pennies;
         public static int sum;
         public static int sum()
                   sum = quarters + dimes + nickels + pennies;
         public static void main(String[] args)
                   System.out.println();
                   int[] values = new int [100];
                   for (int amount = 1; amount < 100; amount ++)
                             quarters = amount/25;
                             int remainder = amount%25;
                             dimes = remainder/10;
                             remainder = remainder%10;
                             nickels = remainder/5;
                             pennies = remainder%5;
                   for (int amount = 1; amount < 100; amount ++ )
                             values[amount] = sum.values[amount];
                             System.out.println(values[amount]);
                   System.out.println();
    The error I get is: int cannot be dereferenced values[amount] = sum.values[amount];
    I have tried troubleshooting this for a while, but can't figure out this error. Thanks so much for your assistance.
    - steve

    Hello,
    Thanks for your response. My intent is to apply the method "sum" (which adds the total number of quarters, dimes, nickels, and pennies) to the elements of the values[ ] array, thus creating a new array that holds the number of coins required for each value.
    So the value at index 1 is 1 (1 penny)
    The value at index 11 is 2 (1 dime, 1 penny)
    The value at index 41 is 4 (1 quarter, 1 dime, 1 nickel, 1 penny)
    etc.
    I played with this a little, and successfully printed the sum for every value by including the statement:
    sum = quarters + dimes + nickels + pennies wihin the first for loop. (So I know my math logic is correct). Now I want to assign these sums to a new array - that's my intent.
    Thanks again for your help and patience.
    Regards,
    steve

  • I recently got a new iPad from Apple, everything was stored to the cloud now I have set up new iPad i have nothing. Apps can b replaced pics cannot. Can anyone help me please?

    I recently got a new iPad from Apple, everything was stored to the cloud now I have set up new iPad i have nothing. Apps can b replaced pics cannot. Can anyone help me please?

    Sorry to read about this. A relative had a similar experience. Just a few things she was told to do. Hopefully one will get your content back. Make sure you are logged in to the same Apple Account the last iPad was. You should have a recent backup that can be downloaded to have your new iPad look like the one you replaced. When I changed from one iPad to another I used my last backup and all my apps and photos reloaded with no issues. This was done over wifi.
    Another way is connecting your iPad to a computer that is logged into your iTunes account. It will show what backups you have available to download To your iPad. Again hopefully a recent backup was made of your iPad with all your most recent content.
    In my cloud settings I made sure any photos I took were uploaded to the cloud to be downloaded automatically to my iPhone and visa versa.
    If you had your photos setup to be uploaded to the cloud they should still be there. You just need to be logged into your Apple ID and your new iPad and I see no reason you cannot access them. Hopefully it is a simple fix.
    good luck.  Jeff

  • This program show me "int cannot be dereferenced" as error can you help me?

    public class Factorial{
         public static void main (String [] args){
              if (args.length<1){
                   showmsg("a Integer Please");
                   else if (args.length>1){
                        showmsg ("Only a Integer please");
                        else {
                             int n;
                             try {
                                  n= Integer.parseInt(args[0]);
                             catch (NumberFormatException nfe){
                             showmsg ("a Integer not a String please"); //call to chow message method
                        factorial(n);
         //show a message
         private static void showmsg (String texto){
              System.out.println(texto);
         //factorial procedure
         public static void factorial (int n){
              int fac=1;
              for (int i=1;i<=n;i++){
                   fac*=i;
              String resu = fac.toString();
              showmsg(resu);
    }

    Thanks for your help, I did change other lines too... (if some body wish Run)
    try {
            int n;
            n= Integer.parseInt(args[0]);
            factorial(n);
    catch (NumberFormatException nfe){
                //call to show message method
               showmsg ("a Integer not a String please");
               showmsg (nfe.getMessage());
    }

  • "The Itunes library file cannot be saved" Error Message (-54) please help!

    Hello, I was loading a music cd onto my itunes library today when I started getting this recurring Error message stating: "The Itunes library file cannot be saved. An unknown error has occurred (-54)"
    It just keeps popping up, and now it let me play anything without getting it. So in a panic I realized that nothing is backed up, so I started backing up my itunes using a blank dvd and even that failed in the middle of burning. I guess it has something to do with the error message?
    This scares me since I'm very careful of the types of discs I put into my Mac, and I know that disc in particular didn't have any kind of virus (its been playing in my car for the last two years actually) and it was burned on my PC using itunes a while back when the system was clean.
    My music is like my life and this message is freaking me out, how do I get rid of the message without damaging my library? or what happened to make it appear?
    I'm afraid of how to proceed next.....Someone please help!

    I suspect some anti-virus software is incorrectly interpreting the rewriting of the file and is causing a problem.
    Either way, you should definitely update your anti-virus software and definitions to the latest, and run a full scan of your system. Then tell the security software not to scan the iTunes itl file/folder.
    If that does not help, you may want to recreate your iTunes library:
    http://docs.info.apple.com/article.html?artnum=93313

  • "Folder "iTunes" cannot be found" error... please help!

    I don't know what's going on with this thing. I am trying to run iTunes (which I know nothing about, since I only got my iPod today), and I keep getting this error message and I have no idea what to do.
    I downloaded and installed iTunes, I got it to stop telling me it had an error and needed to shut down. Now I get this:
    First, I try to open it and I get the License Agreement. I click "I Agree", and a little message pops up that says, "The folder "iTunes" cannot be found or created, and is required. The default location for this folder is inside the "My Music" folder."
    I have no idea what to do about this. Has anyone else had this problem? Does anyone know how to fix it? I have the "My Music" folder in "My Documents" as usual, so I don't know what's going on. I also turned off all my antivirus and antispyware stuff before I installed iTunes. Any help would be greatly appreciated!

    Sol,
    Try this:
    Using TweakUI to Move or Create Your Library/My Music Location
    First, see this Article for some background information: What are the iTunes Library files?
    Use TweakUI (See: ’Disk is locked’ or ‘iTunes folder cannot be found’ when installing or opening iTunes ) to create a 'My Music' folder in a spot where you desire. iTunes should then find this location and deposit its Library files there, and the 'iTunes' folder and sub-folders as well (if you direct it to).

  • "cannot resolve symbol" error...please help

    when itry to compile my program i get the error " cannot resolve
    symbol" variable setLayout.
    My program is very small. Can someone tell me why i keep
    getting error?
    thanx
    trin.
    import java.applet.*;
    import java.awt.*;
    public class MyProg extends Applet
         Button btnOne = new Button("One");
         Button btnTwo = new Button("Two");
         public void init()
              Panel pOne = new Panel( ) ;
              pOne.setLayout = ( new GridLayout( ));
              pOne.add(btnOne);
              pOne.add(btnTwo);
              add(pOne);

    Change:
    pOne.setLayout = ( new GridLayout( ));to
    pOne.setLayout( new GridLayout());It's a method call, not an assignment :)

  • PUlse type signal generation cannot be done. HELP. Please.

    How can I generate a signal using computer in labview software but not using DAQ? 
    I need a continuous pulse signal which is basically increasing and decreasing slowly w.r.t. time. i.e. it's a not pulse as it's already given in labview simulate signal option. I need the d.c. signal which may be will be merge of more than 2-3 signals.  Please Help me with the solution, if possible, or any kind of solution as soon as possible.  
    The image of the pulse is attached herewith. 
    The link of the pulse is : file:///C:/Users/Priyabrata%20Saha/Desktop/internship/pulse.JPG

    Respected Sir altenbach ,
    I need to send the signal to Agilent 6642A dc power supply(0-20V, 0-10A) having gain of 4, for ampilfication and it will be used for my experiment. I am facing problem here. 
    I am using GPIB USB HS for sending the signal and when I am sending commands *IDN , it is successfully reading and writing, which means I have all my softwares and drivers installed perfectly. I have NI MAX and command expert installed in my pc. 
    I have made a program (which is attached) in labview and the GPIB seems to read it ( ACTIVE/Green signal is showing when it is run) . 
    But I cannot see it in oscilloscope (Tektronix TDS 2024B) which means something is wrong here. I need the see the signal as shown in the image attached. 
    I want to see the signal in the oscilloscope as well. 
    Can anyone tell me what is wrong in the program attached? The voltage seems to go upto 1v but suddenly drops at 0.37v and remains constant no matter what I do. 
    I want to control the DC thorough labview. 
    Thanks.

  • Message Error help me please

    Message Error when run Application A_Anexo_7:
    java.lang.NoClassDefFoundError: etica.Anexo_7
         void etica.A_Anexo_7.<init>()
              A_Anexo_7.java:13
         void etica.A_Anexo_7.main(java.lang.String[])
              A_Anexo_7.java:46

    The JVM cannot find the class named "etica.Anexo_7"
    You need to know where this class is located, first off.
    Then, you need to put this class in your classpath.
    You could do
    java -classpath <path_to_your_class> A_Anexo_7
    or (this will not work on windows- its been too long since I used those things)
    export CLASSPATH=$CLASSPATH:<path_to_your_class>
    java A_Anexo_7
    its better not to define your CLASSPATH environment variable because later on you will forget you did and write another help request.

  • CS5 Owl orphanage error , help me please !

    i opened the photoshop CS5 last night and this error pop-up "Owl Orphanage : Photoshop.exe - Application Error . The instruction at "0x4ec7edde" referenced memory at "0x000003f8" , The memory could not be "read" .
    Can someone help me to fix this problem ?

    Hi orocoi,
    I've moved your discussion to the Photoshop General Discussion forum; the experts who visit this forum should be able to help you resolve this issue.
    Sara

  • Publish Error:  Help needed, please!

    When I attempt to publish my site changes from iWeb (I am set up to publish to my personal domain), I get the following error:
    "Publish Error
    Can’t create the file “cherub_overlay65.jpg.” The disk may be damaged or full, or you may not have sufficient access privileges."
    I do not have a photo called "cherub-overlay65.jpg." I think this jpg is part of one of the iWeb "themes."
    Any advice? I have published previously and had no problem at all. =(
    Thanks in advance!

    That song maybe Corrupted...
    If you live in a Region that allows re-downloading Music...
    Delete the Song(s) and re-download...
    See Here  >  Download Past Purchases
    http://support.apple.com/kb/HT2519
    If not... Contact iTunes Customer Service
    Apple  Support  iTunes Store  Contact Us

  • Re: CANNOT FIND SYMBOL ERROR HELP!

    I think you missed the big announcement at the top of this forum and when you posted your message. Here it is again:
    BEFORE YOU POST A TOPIC HERE: Please be sure your topic is related to features or functionality of this site. This forum is not for general technology questions. Not sure which forum to use? Try searching for your topic in the "Search Forums" element on the left panel.
    Please don't reply to this thread.
    ~

    Hello,
    Thanks yawmark, I'll move the thread.
    Please feel free to answer once the thread has been
    moved to a technical topic area.
    Take care,
    Forums Admin

  • HT1349 I am completely lost. I have bought a new Windows 8 PC and want to add it for my i-tunes library. All I get is go to the Store menu for add a new device, but I cannot find it. Help. Please note I am an elderly man who is computer literate but not a

    I have no idea if anyone will read this request, as I am now just pressing buttons, very few of which apply to my query, but have to be completed in order to get the posting processed. Apple is continuing to be rubbish, as I understand very little of what it tells me. My original query is very simple.

    If using iTunes 11... See this Discussion...
    https://discussions.apple.com/thread/4631735?tstart=0

  • My Iphone is on, but home and lock buttons are completely unresponsive. I can swipe the screen but i cannot do anything else. help me please :(

    I was jus trying to download a few new apps when it said I had no storage left, so i went to delete some things, and after i was done, i tried to press the home button to go home. It didn't work, but yet if I clicked it the 3 times it would invert my colors still. I then tried to lock my phone or turn it off and neither worked.
    I can still swipe on the settings screen but nothing else. The AssistiveTouch won't even take me back to my home screen. HELP

    Try holding the Home and Power button together for at least 15 seconds or until the Apple logo comes on.  Then let go and wait for the phone to reset and restart.  This will take a few minutes and you will not lose any data.
    If this does  not work put your phone in recovery mode and connect it to iTunes.   Then restore the phone to factory settings and then restore from backup.  This will wipe your settings and data but if you have made a recent backup it should not be a lot.

Maybe you are looking for