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());
}

Similar Messages

  • Cannot open aperture v3 after upgrading to  OS 10.6.8.  Bought the upgrade online so cannot reload the software.  Can you help?

    Cannot open aperture v3 after upgrading to  OS 10.6.8.  Bought the upgrade online so cannot reload the software.  Can you help?

    How did you buy it online? Did you buy a registration number from the Apple Store?
    Then you can download the Trial version from this link:
        Aperture 3.1 Trial 
    and run Software Update immediately after installing.
    Go to the Applications folder and delete Aperture.
    Download the Aperture 3.1 Trial.
    Open the Aperture Trial disc image.
    Double-click the "Aperture Trial.mpkg" file.
    Follow the onscreen instructions to install Aperture.
    After the installation completes, choose Software Update from the Apple () menu.
    Cannot open aperture v3 after upgrading to  OS 10.6.8. 
    But what exactly is the error you get, when you try to launch Aperture? Maybe you need to do more than updating.
    Regards
    Léonie

  • Since downloading IOS6 I cannot receive or send emails, can you help

    Since downloading IOS6 I cannot receive or send emails, can you help

    I've done that. But the settings "mail, contacts, calendar" are still disabled. For example, if I want to add a new mail account, I can not do it. Because the option "add account" is as if it's turned off, disabled, as well as my other accounts above this ...
    The rest of the IOS6 everything worked out, but with the native Mail app is complicated ...

  • I have iCloud successfully set up my Mac and iPhone   iPad. Mac will not transfer to my other devices. Other devices transfer successfully. I have checked my iCloud setting on my Mac, but cannot see a problem. Can you help me?

    I have iCloud successfully set up my Mac and iPhone   iPad. Mac will not transfer to my other devices. Other devices transfer successfully. I have checked my iCloud setting on my Mac, but cannot see a problem. Can you help me?

    If you have iTunes 11 on your computer then you can enable the left-hand sidebar on it via option-command-S on a Mac, control-S on a PC - when connected (and if your computer's iTunes is up-to-date) your iPad should then appear on that sidebar under a 'Devices' heading :
    If you select the iPad on that sidebar you can then use the Movies tab on the right-hand side of the iTunes screen to select and sync that film to your iPad's Videos app.
    Has your iPad been synced to the computer before ? If not then you might find this page for syncing to a new computer useful : https://discussions.apple.com/docs/DOC-3141

  • I am trying to connect my Apple TV to an older Panasonic projection TV using an HDMI to a DVI cable to the Digital IN. I cannot get any sound. Can you help?

    I am trying to connect my Apple TV to an older Panasonic projection TV using an HDMI to a DVI cable to the Digital IN. I cannot get any sound. Can you help?

    DVI interface does't allow audio. Is there optical IN from your Panasonic TV? By then you can connect your ATV to Panasonic using optical together. It will work.

  • HT201210 I have Geo Asian TV App on my IPad which was working fine before loading ios6.  Now if try to run the video in this app, it says adobe reader or html5 required. Can you help

    I have Geo Asian TV App on my IPad which was working fine before loading ios6.  Now if try to run the video in this app, it says adobe reader or html5 required. Can you help

    It may have used the YouTube app that is no longer included in iOS. Try downloading the YouTube app in the App Store and see if it works.

  • I have just update my iphone 4 to ios5. i cannot find my photos anywhere can you help? Thanks

    i have just updated my iphone 4 to ios5. i cannot find my photos anywhere can you help? Thanks

    Hey Kate
    if you have backed up your iPhone, photos that were taken on the iPhone will be in the back up file. Any photos synced to your iPhone from a computer will need to be synced again. To restore your iPhone from a back up right click on the name of your iPhone in iTunes and select restore from back up.

  • Downloaded screensaver from Hallmark,but this Screentime media keeps installing but cannot get it to work can you help

    Have downloaded Christmas screensaver from Hallmark.  This Screentime media has to install and I keep installing but it still won't open,  It is in my downloads and when I click on it it says to install and I do  4 times now and I still cannot get it to open.  Can anyone help with suggestions.  Very frustrating.
    Thanks again 

    The ones I see from > screensavers Hallmark are for Windows OS only.
    Maybe try some at > OS X Christmas Screensavers - Google Search

  • Cannot get connected to itunes can you help

    i cannot get connected to itunes on my ipad - can anyone help?

    Are you talking about the calendar app?  go to settings - general - reset - reset home screeen layout.

  • HT5312 I have just upgraded to a new computer and cannot remember my security questions can you help me please

    I would like to have my security questions reset I don't remember my answer for my favorite car. I just had a new computer set up because my xp was outdated

    You need to ask Apple to reset your security questions; ways of contacting them include phoning AppleCare and asking for the Account Security team, clicking here and picking a method for your country, and filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (105121)

  • My browser is gone, is not there, I cannot bring it up again, can you help me? I am using firefox 9.1

    I always had this browser next to file, edit etc. Now for the past day, that browser is gone I do not know how to bring it up again. Please help me.

    You can try a couple of things:
    Tap Settings > WiFi > and then the blue ">" next to the network name.  Find "Renew Lease" and tap on that.
    Tap Settings > Airplane Mode On.  Wait a few seconds and turn it back off.

  • YouTube would not open just spinning and not opening.I cannot open videos on Facebook can you help?

    YouTube would not open just spinning and telling me there is an error  retry but it does not open. I deleted it and put it back still the same thing.can anyone help please? I am using an iPad

    Hi Tavionval,
    I apologize, I'm a bit unclear on the exact nature of the issue you are describing. If you are having issues with the YouTube app itself crashing or not launching, you may find the troubleshooting steps outlined in the following article helpful:
    iOS: An app you installed unexpectedly quits, stops responding, or won’t open - Apple Support
    Regards,
    - Brenden

  • Hello, I used to have an add-on that would make my browser save my online banking login info..which browsers usually don't..so it forced Firefox to do it. I cannot remember the name though, can you help me?

    The banking sites usually prevent log-info from being saved, but there was a way around it..
    i want to save them on my computer just like any other passwords..
    i forgot the name and address of that add-on

    you can use Lastpass Password Manager, its Safe and Free :)
    * https://addons.mozilla.org/en-US/firefox/addon/lastpass-password-manager/

  • "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                                                                                                                                                                                                                               

  • 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

Maybe you are looking for