Small issue in small program(code) that need to be fixed ...

Hi Guys ,
i need ur help in some kind of issue( technique thing ;) ). i have done small program that ask for numbers then print them and told u how many Odd numbers.
the issue that i have it, is that the program when print the result (the numbers) it print them correctly but print with them word "null".
i need ur help to avoid that word.
How???
sorry for my bad english, since i don't know english well.
and thank u soo much for ur help ;)
this is the code:-
import javax.swing.JOptionPane;
     // takes number from the user and show u the odd number and print them
public class Odd {
     public static void main(String[] args) {
          String n,m;
          int a=0;
          int x=1;
          String result = null;
          n=JOptionPane.showInputDialog(null,"How many number do you want to check for the odd ? ");
          int n1 = Integer.parseInt(n);
          int array[]=new int[n1];
          for(int i=0;i<array.length;i++){
               m=JOptionPane.showInputDialog(null,"Enter number "+x);
               array[i] = Integer.parseInt(m);
               result=result+array[i]+"\n";
               x++;
               if( array%2 !=0 )
                    a++;
               JOptionPane.showMessageDialog(null,"The Numbers Are :\n"+ result);
               JOptionPane.showMessageDialog(null,"The Odd Numbers are:\n " a" Numbers");

First of all you don't need to feel yourself sorry. Here is a Java forum not an english literature forum and at least I can understand you. At least you don't try to write in your language which we probably may not understand.
Secondly if you initialize your String value like that you have the null value. You can initialize it like
String result = new String(); and try it again.

Similar Messages

  • HT204210 Still nothing about File Vault that needs a bug fix for almost every user. This is becoming even more disappointing!

    Still nothing about File Vault that needs a bug fix for almost every user. This is becoming even more disappointing!

    Apple Enterprise Support is aware of this issue. They have specific instructions which attempt to remediate the issue, however, attempting on two different MBP laptops, so far has not succeeded.
    The problem to be specific is - hang at login. The Filevaulted user account gets its password entered, then the "progress bar" mid screen will be seen to halt, never resuming. NVRAM resets dont necessarily cure this issue, but turning off FV2 definitely does.
    We are seeing this with 10.10.2 fully Apple-SUS updated machines.
    Feedback has been sent to Apple over this as well.
    Im recommending:
    a. turn off FV2 until such time as a Apple provided update cures it
    b. consider the Sophos WDE solution if WDE is absolutely required (disclosure: I havent attempted this, not sure about its workability)

  • I need help with IOS 7, there is a major bug that needs to be fixed in an upcoming Update

    There is a big that needs to be FIXED an in upcoming update.
    Ok, on my ipad, the notifacation center says the weather is going to be 13 degrees celceuis, I am wanting to use the American metric units, which is Fahrenheit, how do I fix it, it says yahoo provides weather info! I taped on it, it led me to the internet, it said on yahoos website that it is 88 degrees Fahrenheit, but it won't show up on my ipad notifaction center,  how do I fix it?? Need help
    I have already done a hard reset, I also did location service off and then back on, the problems persist, some one told me that a third party weather app was changing the weather to celceuis, this is NOT true, need help how do I fix this?
    I have IPAD 3 gen, IOS 7

    Apple will never see your post here
    They do not monitor these posts for problems
    You really should post at
    http://www.apple.com/feedback/iphone.html
    http://www.apple.com/feedback/ipod.html
    http://www.apple.com/feedback/ipodtouch.html
    http://www.apple.com/feedback/ipad.html
    Allan

  • I see programming codes intermixed with emails. any fixes? email removed

    just that. programming codes mixed in with emails. do i need to set something?

    Firefox doesn't do email, it's a web browser.
    If you are using Firefox to access your mail, you are using "web-mail". You need to seek support from your service provider or a forum for that service.
    If your problem is with Mozilla Thunderbird, see this forum for support.
    [http://www.mozillamessaging.com/en-US/support/] <br />
    or this one <br />
    [http://forums.mozillazine.org/viewforum.php?f=39]

  • N70 problems that need to be fixed in next FW

    Since there's been a time since Nokia released a new FW for the N70, maybe they need to know what need to be fixed, and ASAP, since these are severe problems.
    1. The Music Player: It starts slow, very slow. In the v2 and v3 FW it used to open in a second, now it takes almost a minute. It displays the "Opening" sequence, and then "Processing" sequence, and only after that you enter the Music Menu. Also, veru important issue: If you go to All Songs -> select a song, and then hold a button from the joystick, the Music Player crashes. But the opening is the MOST IMPORTANT. Make it quicker.
    2. The Gallery has to be faster. We have to wait a lot of time for the Gallery to open, then we select Pictures & Videos. Here we find a "Opening" sequence of about a minute, and then we wait a lot until the pictures are loaded (if they're newly added).
    3. Speaking of pictures, when N70 owners make a picture/video, they don't really have time to view the picture/video, since the viewing time is very limited (about 3 seconds). How about making a BACK button, so that we'll go back to the viewfinder when we're done viewing newly captured moments?
    4. When in Messaging -> Delivery reports, you can't use the C button to delete delivery reports.
    5. No information about Radio in Active Standby, when Radio is on and playing.
    These are only a few of the problems that the N70 continues to have. Please, other N70 users, post your issues/bugs here, so that Nokia will try (hopefully) to improve the N70. I know the N70 is not an important product anymore, but it does not mean it has to have serious issues.
    Thank you.Message Edited by geojoking on 19-Jan-2007
    09:43 PM
    Previous phones: 3330, 3410, 3510i, 3200, 6230, Nokia N70, Nokia N73, Nokia N82, Nokia 5500 Sport & Nokia N97
    Current: Nokia N900

    Hi all,
    I have my problems described on /discussions/board/message?board.id=smartphones&message.id=24567
    1. It's video capture problem - microphone sensitivity is too high (only on mp4 and only on 5.xx firmware). Also refresh rate during videocapture is very slow. It's not possible to make nice mp4 video capture! Interesting is that 3gp capture is nice, fast with clear sound, only mp4 capture have a problem...
    2. I don't know why it's not possible to make clean reboot now. (e.g. on FExplorer, reboot). N70 with last firmware during reboot freezes (white screen)
    3. Should be possible to turn off the Nokia sound during N70 starting? I have little childrens and every morning when I turn on my N70 they all awake...
    NOKIA, please, is it possible to prepare new fw?
    DaSoft - N97 mini, N95II, old N70+1G kingston fw 5.0638.3.013 18-09-06 RM-84. (Orange SK)
    Other phones: HTC HD2, HTC TYTN, SE K800i+1G Sony, SGH-Z400...

  • High pitched static on other end is a software bug that needs to be fixed immediately

    Every once in a while, the callers on the other line start hearing nothing but a high pitched static from me. I have no idea when it happens or what causes it. I can hear the other person just fine but they cannot hear me at all. I find out when the other person keeps saying hello and eventually hangs up. Once it happens, it happens on every call after that. 
    The only thing that fixes it is restarting the phone which is extremely annoying. This is most definitely a software bug and has nothing to do with whether you have good signal or if you use a case or not.
    I tested this with by calling my wife's phone when she was with me after the glitch happened.
    1) I had no case on the phone.
    2) I was getting a perfect signal (also perfect 4g)
    3) Switching to loudspeaker did nothing.
    4) Turning noise reduction on or off did nothing.
    5) muting and unmuting did nothing (except when muted there was obviously no static, but it came back upon unmuting)
    6) Turning wifi on or off did nothing
    7) Turning bluetooth on or off did nothing
    Answering an important call and hearing "hello, hello, hello and click" is the most annoying thing ever. Because then I have to restart my phone which takes quite a while and the other person is repeatedly calling me in the meantime. 
    This needs to be fixed immediately. After all, this device is a phone first. All those smart functions come second. If I can't make or receive calls properly this device has to go.

    Oh no! This definitely can be annoying!!
    We have had others with the Droid Charge call/write in with the same issue. Replacing the phone didn't resolve which also leads me to believe it is a software glitch.
    First, make sure you do have the most recent sofware version vy going to:
    Settings>About Phone>System Updates>Check New    You should currently have i510EE4
    We have let Samsung know that there is an issue with some of the Droid Charge's having a high pitched noise.
    At this time, they are looking into it in order to provide a resolution.

  • Small issue in dialog program

    Hello all,
    i have a requirement in dialog programming.
    I have to modify a record a record which exist in zatble.
    For each record , i have a header info, item details.
    for header iam ok , i can use modify.
    for item details i have like
    itemno    material     materialdesc quantity
    1          m1           pqr          12
    2          m2           def          9
    3          m3           abc          2
    4          m4           xyz          1
    item no and material are my primary keys.
    so iam retrieving this data from a z table and have to update.
    may be i need to delete 3 record and modify 2 record,i would do that based on the selectionfrom table control
    itemno    material     materialdesc quantity
    1          m1           pqr          12
    2          m2           def          19
    3          m4           xyz          1
    now i have deleted 3 record and modifed 2 with increase in quantity and the itemno are changed
    I have ths data in my internal table.
    iAM USING MODIFY STATEMNT WHEN I SAVE THE DATA INTO DATABASE TABLE.
    i SEE THE FOLLOWING DAT AIN MY ZTABLE
    1          m1           pqr          12
    2          m2           def          19
    3          m3           abc          2
    4          m4           xyz          1
    3          m4           xyz          1
    THOGHT I NEED ONLY THESE DATA TO BE PRESENT IN MY ZTABLE
    1          m1           pqr          12
    2          m2           def          19
    3          m4           xyz          1
    Any help or suggestions regarding this
    Thanks
    Suchitra

    Hi suchitra,
    do one thing ,,
    first task
    1.first of all select all the contents of ztable based on primary keys into a internal table itab.
    1 m1 pqr 12
    2 m2 def 9
    3 m3 abc 2
    4 m4 xyz 1
    2. in ur m-pool table control u r performing the operations like delete and modify to the table control GET THE CONTENTS INTO UR FINAL TABLE JTAB ..Lets say
    This is ur final jtab.
    1 m1 pqr 12
    2 m2 def 19
    4 m4 xyz 1
    NOW PERFORM COMPARISIONS,
    3.  LOOP AT ITAB.
        READ TABLE JTAB WITH KEY ITEMNO = ITAB-ITEMNO
                                                       AND MATNR  = JTAB-MATNR
                                                        And  menge     =  jtab -menge       
              IF SY-SUBRC <> 0.
                ITAB-ITEMNO  = JTAB-ITEMNO.
                ITAB_MATNR   = JTAB-MATNR.
                ITAB_MATDESC = JTAB_MATDESC
                ITAB_MENGE   = JTAB_MENGE
                MODIFY  ITAB. ”TRANSPORTING 
              ENDIF.
              ENDLOOP.
    THIS WILL COVER RECORD 2 IN UR ITAB CHANGES ARE OK  ..
    second task ..
    4. NOW SINCE U HAVE DELETED RECORD 3 ,, PLACE  IN AN EXTRA FILED IN THE JTAB  STRUCTURE
    LIKE CHAR TYPE C, SAME HAS TO BE IN ITAB ALSO
    AND MAKE IT X WHEN EVER U DELETE IT IN TABLE CONTROL
    LIKE THIS THE O/P IM EXPECTING HERE IS IN JTAB
    1 m1 pqr  12
    2 m2 def   19
    3 m3 abc    2     x
    4 m4 xyz   1
    LOOP AT ITAB.
        READ TABLE JTAB WITH KEY ITEMNO = ITAB-ITEMNO
                                                       AND MATNR  = JTAB-MATNR
    IF JTAB-CHAR = ‘X’.
                ITAB-ITEMNO     = JTAB-ITEMNO.
                ITAB_MATNR      = JTAB-MATNR.
                ITAB_MATDESC = JTAB_MATDESC
                ITAB_MENGE      = JTAB_MENGE
                ITAB-CHAR          = JTAB-CHAR
                MODIFY  ITAB.  ”TRANSPORTING 
              ENDIF.
      ENDLOOP.
    NOW THE ITAB CONTENT IS
    1 m1 pqr  12
    2 m2 def   19
    3 m3 abc    2     x
    4 m4 xyz   1
    My suggestion to u is modify the ztable from itab .
    Without deleting entry 3
    This will solve ur prob .
    Cause when u do a select next time
    Select entries where  char <> ‘X’
    Which will fetch u
    1 m1 pqr 12
    2 m2 def 19
    4 m4 xyz 1
    Try to bring the logic in a single loop this will do
    i have split this for ur understanding ....

  • My iMac does not shutdown but says I have programs open that need to force quit

    My iMac does not shutdown but says I have programs open and that I must force quit and will lose changes.
    But nothing is open all are shutdown and I dont know is this a problem with the Mac or the software ?

    Is Preview open? Copy/paste the following into Terminal in Utilities and hit return. Look through the output, which may give you a clue as to what is open.
    lsof -l +L -R -V | grep /

  • I just got Windows 7 - and it's on a new computer, so there are no old settings that need to be 'fixed'. Why does Firefox open "squished"? It doesn't fill the whole page. It's margins are about 4 inches in, on both the right and the left.

    I have no other details to add, that I know of. Firefox just does not fill the entire page.

    1) ensure iTunes is authorized for your iTunes store account(s)
    2) connect your device and right-click or control-click it in the iTunes Source list, then choose transfer purchases from the shortcut menu that appears.
    3) sync the device
    iTunes will wipe the iPhone but, since you transferred your purchases in the previous step, your content will be in your library and you can re-populate the iPhone with it.
    above works for purchases from the iTunes store. for everything else, check out this post by Zevoneer.

  • 3 Bugs in LR3 that need to be fixed.

    1.  Ratings do not carry over to modified .tiffs from Photoshop.  After sending a file to Photoshop to be edited, saved, and the resulting .tiff automatically added to LR3, the rating does not carry over to the new tiff from the original file.
    2.  Filter settings reset when changing folders.  Why reset when going back to the folder where we had changed it?  Why does it reset at all?
    3. No reverse sort for folders in library.  My common folders are at bottom of long list and requires scrolling.  Not a bug but seems easily fixed.
    Bug 1 and 2 were not present in LR2.

    1 is a bug.
    2 is intentional, though there's been quite a lot of feedback that not everyone is happy.
    3 is a feature request.

  • Itunes 8 upgrade problems. Is there a bug that needs to be fixed?

    (macbook, os 10.5.4)
    It downloaded the itunes 8 upgrade several days ago. It was working fine, for a few hours and I was enjoying the new icons, etc.
    Then, all of a sudden, I could no longer open up that itunes window, no matter what I did. I tried disk utilities, verifying and repairing permissions, as an apple friend recommended, that didn't help. I then went and re-installed itunes 8, AGAIN, and nothing changed.
    So now, in order to access any of my itunes library, music, etc. I have to go into find and put in itunes and then I can find all my stuff and I can access, but I'd like to get my itunes window back.
    Please help with very explicit instructions. I am a non-techy and am amazed I even figured out how to do what I've done.
    Thanks!
    macbook Mac OS X (10.5.4)

    I had the same problem with my sister's iphone. Mine would show up but not her's.
    Her phone was password protected , so I asked her to unlock her phone and I plugged it back again and it worked right away. Try it if it's password protected !

  • I have an ipod touch 2nd generation that needs the screen fixed because the left side quit working any Idea on a price

    The left side of my screen quit working any idea what the price on a replacement costs?

    Apple will exchange your iPod for a refurbished one for this price. They do not fix yours.
    Apple - iPod Repair price
    A third-party place like the following maybe less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Replace the screen yourself
    iPod Touch Repair – iFixit

  • Need help on fixing this bug

    Hello!
    I have my cod which needs some bug fixing. This is a drag and drop application where the user will drap the correct answer on corresponding targets. My problem here is, when one target is already occupied by an object i can still drop another object there, which shouldn't. can you please help me fix this?
    thanks in advance!
    Sincerely.
    Milo
    Here's my code:
    var startX: Number;
    var startY: Number;
    var correct: Number = 0;
    var attempt: Number = 0;
    var currentlyDragged:MovieClip;
    // collection of objects stored in array
    // so that you can reference them programmatically
    var objects:Array = [at1, in1, in2, in3, in4, in5, in6, in7, in8, on1, on2];
    activateObjects();
    // assigns listeners and other functionality to the objects in objects array
    function activateObjects():void {
         for each(var mc:MovieClip in objects) {
              mc.addEventListener(MouseEvent.MOUSE_DOWN, pickObject);
              mc.buttonMode = true;
              // assign drop targets based on names
              switch(String(mc.name).substring(0, 2)) {
                   case "at":
                        mc.dropTargets = [targetAT1];
                   break;
                   case "in":
                        mc.dropTargets = [targetIN1, targetIN2, targetIN3, targetIN4, targetIN5, targetIN6, targetIN7, targetIN8];
                   break;
                   case "on":
                        mc.dropTargets = [targetON1, targetON2];
                   break;
    function pickObject(e:MouseEvent):void {
         currentlyDragged = MovieClip(e.currentTarget);
         currentlyDragged.startDrag();
         startX = currentlyDragged.x;
         startY = currentlyDragged.y;
         stage.addEventListener(MouseEvent.MOUSE_UP, dropObject);
    function dropObject(e:MouseEvent):void {
         stage.removeEventListener(MouseEvent.MOUSE_UP, dropObject);
         stopDrag();
         var droppedOn:MovieClip;
         if (currentlyDragged.dropTarget) {
              // loop through targets belonging to the currently dragged clip
              for each(var mc:MovieClip in currentlyDragged.dropTargets) {
                   if (currentlyDragged.hitTestObject(mc)) {
                        // get the target
                        droppedOn = mc;
                        currentlyDragged.removeEventListener(MouseEvent.MOUSE_DOWN, pickObject);
                        currentlyDragged.buttonMode = false;
                        currentlyDragged.x = droppedOn.x;
                        currentlyDragged.y = droppedOn.y;
                        correct++;
                        correctCounter.text = String(correct);
                        // stop loop - it is not necessary to continue
                        break;
         attempt++;
         attemptCounter.text = String(attempt);
         // return to the initial position if there is no hit
         if (!droppedOn) {
            currentlyDragged.x = startX;
            currentlyDragged.y = startY;
         if (correct == objects.length) {
              var congrats:CongratsMC = new CongratsMC();
              // place i in the middle of the screen
              congrats.x = (stage.stageWidth - congrats.width) * .5;
              congrats.y = (stage.stageHeight - congrats.height) * .5;
              addChild(congrats);

    Try the code below.
    Also, use int instead of Number whenever possible - it is smaller and faster.
    import flash.display.MovieClip;
    import flash.display.Sprite;
    var startX:Number;
    var startY:Number;
    var correct:int = 0;
    var attempt:int = 0;
    var currentlyDragged:MovieClip;
    // collection of objects stored in array
    // so that you can reference them programmatically
    var objects:Array = [at1, in1, in2, in3, in4, in5, in6, in7, in8, on1, on2];
    var congrats = new CongratsMC();
    congrats.addEventListener("close", closeCongrats);
    activateObjects();
    // assigns listeners and other functionality to the objects in objects array
    function activateObjects():void {
         for each(var mc:MovieClip in objects) {
              mc.addEventListener(MouseEvent.MOUSE_DOWN, pickObject);
              mc.buttonMode = true;
              // assign drop targets based on names
              switch(String(mc.name).substring(0, 2)) {
                   case "at":
                        mc.dropTargets = [targetAT1];
                   break;
                   case "in":
                        mc.dropTargets = [targetIN1, targetIN2, targetIN3, targetIN4, targetIN5, targetIN6, targetIN7, targetIN8];
                   break;
                   case "on":
                        mc.dropTargets = [targetON1, targetON2];
                   break;
    function pickObject(e:MouseEvent):void {
         currentlyDragged = MovieClip(e.currentTarget);
         currentlyDragged.startDrag();
         startX = currentlyDragged.x;
         startY = currentlyDragged.y;
         stage.addEventListener(MouseEvent.MOUSE_UP, dropObject);
    function dropObject(e:MouseEvent):void {
         stage.removeEventListener(MouseEvent.MOUSE_UP, dropObject);
         stopDrag();
         var droppedOn:MovieClip;
         correctCounter.text = String(correct);
         if (currentlyDragged.dropTarget) {
              // loop through targets belonging to the currently dragged clip
              for each(var mc:MovieClip in currentlyDragged.dropTargets) {
                   if (currentlyDragged.hitTestObject(mc)&& mc.notUsed) {
                        // get the target
                        droppedOn = mc;
                        mc.notUsed = false;
                        currentlyDragged.removeEventListener(MouseEvent.MOUSE_DOWN, pickObject);
                        currentlyDragged.buttonMode = false;
                        currentlyDragged.x = droppedOn.x;
                        currentlyDragged.y = droppedOn.y;
                        correct++;
                        correctCounter.text = String(correct);
                        removeTarget(droppedOn);
                        // stop loop - it is not necessary to continue
                        break;
         attempt++;
         attemptCounter.text = String(attempt);
         // return to the initial position if there is no hit
         if (!droppedOn) {
            currentlyDragged.x = startX;
            currentlyDragged.y = startY;
         if (correct == objects.length) {
              // place i in the middle of the screen
              congrats.x = (stage.stageWidth - congrats.width) * .5;
              congrats.y = (stage.stageHeight - congrats.height) * .5;
              addChild(congrats);
    function removeTarget(target:Sprite):void {
         var i:int = 0;
         for each(var mc:MovieClip in objects) {
              for (i = 0; i < mc.dropTargets.length; i++) {
                   if (mc.dropTargets[i] == target) {
                        mc.dropTargets.splice(i, 1);
    function closeCongrats(e:Event):void {
         removeChild(congrats);

  • TS1646 I'v tried many times to update my applications however, my account can't do it because security code for my card is incorrect note that I'm sure my card details are correct completely so i need help to fix it as much as you can plz. Thnks

    Hi
    I'v tried many times to update my applications however, my account can't do it because security code for my card is incorrect note that I'm sure my card details are correct completely so i need help to fix it as much as you can plz. Thnks

    Look, I understand I still need a card attached to the account. The problem is, it won't accept my card because I only have 87 cents in my bank account right now.
    If I had known there would be so much trouble with the iTunes card, I would have just put the cash in my bank account in the morning instead of buying an iTunes card (I didn't expect the banks to be open on Thanksgiving of course).
    Apple will only accept cards that have a balance. The balance is so small in my account that it won't accept it as a valid card.
    I'm going to have to contact Apple anyway to reset the security questions. That's obvious. Your answers were not exactly helpful. You didn't tell me anything I don't already know, but thanks for trying to be helpful.

  • I have trouble seeing the small icons for the program functions in this tutorial.

    Hello,
    I have my assets from an older site, and want to start a site desktop site in muse. Is there a program ( maybe a book ) that can walk me through this step by step, instead of the Katie's Cafe demo / tutorial?
    The problem with the tutorial is in the dark interface I have trouble seeing the small icons for the program functions.
    I really need to setup a new site as soon as possible, but am not getting there right now.
    Thanks.
    Patricia Goff

    You can download the pdf from here :
    https://helpx.adobe.com/pdf/muse_reference.pdf
    Thanks,
    Sanjit

Maybe you are looking for