Why do I need to put spaces in here?

I wrote a section of code like this:
// increment the count each time countJButton is pressed
private void countJButtonActionPerformed( ActionEvent event )
countJTextField.setText ( String.valueOf(
1 + Integer.parseInt(countJTextField.getText())));
} // end method countJButtonActionPerformed
I was able to compile and run with no errors but the code did nothing in the program. I then placed spaces in between the brackets like this:
countJTextField.setText ( String.valueOf(
1 + Integer.parseInt(countJTextField.getText() ) ) );
and it runs. I thought Java is suppossed to ignore white space. So why does the first example not run and the second one run? What is the rule I need to know to do this correctly. (The books don't tell me and my instructor doesn't know).

No nothing else was changed. I used javac to compile and got no errors. I then ran the program java Application. The application did nothing. I went back put in the spaces and resaved. javac to compile new and java Application to run and it works.
Further I took the assignment to class. Class and teacher looked at it and could find 'nothing' different between there programs that ran and mine that didn't expect the spaces so I got the recommendation to try the spaces.
The jdk I'm presently using came with the course book (Dietel's Simply Java Tutorial approch), which is j2sdk1.4.1_02. I have 1.5 on another Dietel book (How to program Java, 6th edition) I tried to compile a program from the 2nd book and recieved all kinds of errors. Sent a email to Dietel who advised me that the programs in the 2nd book were written to work with Java 5. I'm concerned about installing Java 5 and maybe not having it work on teh Simply Jaava Tutorials which make up the bulk of the course.
All comments are appreciated.

Similar Messages

  • Why do we need to put \\\\ for inserting a single \

    Hi,
    I wanted to replace the string h"i with h'i. The following code does that.
    public class replace {
         public static void main(String a[]) {
              String hel = "h\"i";
              System.out.println(hel);
              hel = hel.replaceAll("\"","\\\\");
              System.out.println(hel);
    My question is why do we need to put 4(\\\\) back slash for inserting a single \? Why not just put 2(\\) back slash? Your help is appreciated.
    Sundar.

    Hi,
    Could you please explain bit more on this. Im talking about the second argument in replaceAll method.
    All i want is to replace the double quote in the string h"i with h\i.
    Why cant the code look like this hel = hel.replaceAll("\"","\\");
    If i use this code i get the following exception.
    Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 1
    at java.lang.String.charAt(Unknown Source)
    at java.util.regex.Matcher.appendReplacement(Unknown Source)
    at java.util.regex.Matcher.replaceAll(Unknown Source)
    at java.lang.String.replaceAll(Unknown Source)
    at hello.main(hello.java:70)

  • Why do you need to put credit card details in to the app store when you may want to simply obtain free items in the beginning?

    Apple clearly is a leader and thankfully are bringing fantastic products and initiatives to the market. 
    I certainly hope that the company doesn't get arrogant like it seems to do when forcing people trying to get free apps to put in credit card details. 
    I suspect it wouldn't be too much work to allow users to try it out first by using some free apps and when they are personally ready they can purchase to their little hearts desire.
    Poor showing from this perspecitive and easy to fix.

    Never put your credit card info into iTunes as Apple credit card security is horrible.  There are many cases of credit card problems with Apple. My credit card was compromised 2 weeks after creating an Apple account. That was the ONLY online usage of my credit card. 
    Apple does NOT follow PCI compliance which is the credit card industry standards for credit card data protection.  It requires all companies to NOT store credit card information online because (surprise, surprise Apple!) it can be hacked. 
    Why does Apple need to store the credit card data and put the information at risk and why do they not follow industry (PCI Compliance) guidelines - especially for free aps or updates?

  • HT5622 Why do i need to put in a card number or credit card number to update a free app.?

    It will not let me download or update a free app with out putting in a card. At first it let me naow its acting up.!

    http://support.apple.com/kb/ht2534

  • Why do i need to use a credit card to do updates

    I don't want to set up iTunes with a credit card, however, when I try to update something like iPhoto it requires me to have a credit card.  If it is a free update then why do I need to put in a credit card number?

    jfyjperk wrote:
    I don't want to set up iTunes with a credit card,
    Then don't:  Create an iTunes Store, App Store, or iBooks Store account without a credit card or other payment method

  • I want to know that if i want to download facebook on my iphone 4 or any other apps then it ask me put my card details for payment. why is that. if they are free then why do i need to give my card details?please help me anyone.

    I want to know that if i want to download facebook on my iphone 4 or any other apps then it ask me put my card details for payment. why is that. if they are free then why do i need to give my card details?please help me anyone.

    Just select no credit card as outlined here:
    http://support.apple.com/kb/ht2534

  • Hi everyone I have a macbook pro mid 2010 17'' 2.66 i7 looking to put a new hard drive in it something like a 250 gb  ,  orig drive 500 gb 5400 toshiba but i don;t really need that much space so i would like some input, type,speed,brand,compatibly,noise

    I have a macbook pro mid 2010 17'' 2.66 i7 looking to put a new hard drive in it something like a 250 gb  ,  orig drive 500 gb 5400 toshiba but i don;t really need that much space so i would like some input, type,speed,brand,compatibly,noise Thank You!!

    There's no reason to install a smaller hard drive. In some cases, it may decrease performance.
    Your MacBook Pro comes with a 5400 rpm hard drive, so what you can do is to install a smaller, 7200 rpm hard drive, so you will get a better performance. Any 2'5" SATA hard drive will work, but you can have a look at OWC for hard drives > http://eshop.macsales.com/shop/hard-drives/2.5-Notebook/
    HGST and Seagate hard drives have a good reputation, so you can purchase one of them

  • Seriously, this issue is really annoying. why wont my songs download? it wont stop saying there is an error. this needs to be fixed. refund or apple needs to put these songs in my itunes manually if that can be done.

    seriously, this issue is really annoying. why wont my songs download? it wont stop saying there is an error. this needs to be fixed. refund or apple needs to put these songs in my itunes manually if that can be done.

    seriously, this issue is really annoying. why wont my songs download? it wont stop saying there is an error. this needs to be fixed. refund or apple needs to put these songs in my itunes manually if that can be done.

  • Why is it that I need to put in my id password every time I want to erase a file on my laptop?

    Why am I requested to put my Id password everytime I want to delete a file on my Macbook pro.I think I must have done a change in the setting somewhere. But it was not like that before. Thanks in advance.

    Back up all data before proceeding.
    This procedure will unlock all your user files (not system files) and reset their ownership, permissions, and access controls to the default. If you've intentionally set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it, but you do need to follow the instructions below.
    Step 1
    If you have more than one user, and the one in question is not an administrator, then go to Step 2.
    Triple-click anywhere in the following line on this page to select it:
    sudo find ~ $TMPDIR.. -exec chflags -h nouchg,nouappnd,noschg,nosappnd {} + -exec chown -h $UID {} + -exec chmod +rw {} + -exec chmod -h -N {} + -type d -exec chmod -h +x {} + 2>&-
    Copy the selected text to the Clipboard by pressing the key combination command-C.
    Launch the built-in Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window by pressing command-V. I've tested these instructions only with the Safari web browser. If you use another browser, you may have to press the return key after pasting.
    You'll be prompted for your login password, which won't be displayed when you type it. Type carefully and then press return. You may get a one-time warning to be careful. If you don’t have a login password, you’ll need to set one before you can run the command. If you see a message that your username "is not in the sudoers file," then you're not logged in as an administrator.
    The command may take several minutes to run, depending on how many files you have. Wait for a new line ending in a dollar sign ($) to appear, then quit Terminal.
    Step 2 (optional)
    Take this step only if you have trouble with Step 1, if you prefer not to take it, or if it doesn't solve the problem.
    Start up in Recovery mode. When the OS X Utilities screen appears, select
              Utilities ▹ Terminal
    from the menu bar. A Terminal window will open. In that window, type this:
    resetp
    Press the tab key. The partial command you typed will automatically be completed to this:
    resetpassword
    Press return. A Reset Password window will open. You’re not going to reset a password.
    Select your startup volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
               ▹ Restart
    from the menu bar.

  • TS3274 Do I really need to put my debit card information to get a free app ? Why ?

    Do I really need to put my debit or credit card information to get a FREE app ? Why ?

    You can try removing the card in your account information, but if that credit card expired before you removed it, you might be stuck now,
    Settings>Store (or iTunes & App Stores in iOS 6)>Apple ID. Tap your ID. Then tap View Apple ID. Enter your password. Tap the arrow next to Payment Information and select None if it is available in your settings. See if that will work for you.
    If iTunes doesn't accept that or if you didn't have None in the options, you are stuck until you enter e new card.

  • I need to restore my sons ipod touch because he forgot his pswd.  I can do this but it asks to backup first and my computer has no more memory to do this.  Aren't all my itunes app purchases stored anyway?  Why do I have to put this info onto my labtop?

    I need to restore my sons ipod touch because he forgot his pswd.  I can do thisby hitting restore in itunes, but it asks to backup first and my computer has no more memory to do the backup.  Aren't all my itunes app purchases stored anyway?  Why do I have to put this info onto my labtop?

    The iPod backup that iTunes makes does not inlcude synced media like apps and music. Those items should be in your iTunes library.
    You can redownload iTunes purchases by:
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • HT4859 I have iCloud for my iPhone, my daughters iphone and 2 of my ipads and have purchased the max amount of storage I can but still get a message saying i don't have enough space to store anymore. Do I need to put each device on their own account?

    I have iCloud for my iPhone, my daughters iphone and 2 of my ipads and have purchased the max amount of storage I can but still get a message saying i don't have enough space to store anymore. Do I need to put each device on their own account?

    adkennon wrote:
    And maybe you don't talk to too many people but I've been on many forums on different websites where people have had similar problems and a lot of people in the store were having battery problems where they were draining too fast. What I learned is that all the people who did not download the updates are good. There phone is working the same. The people who have, they're having battery problems
    I have downloaded every update and my battery life is better than any previous iPhone I have ever owned. I see posts from hundreds of people every day, and this is not a commonly reported problem. While there are a few random reports of battery problems, it is no more than I have seen for any other model or any other version of iOS in almost 8 years. Usually problems of rapid battery drain can be traced to bad apps (FaceBook is the worst offender) or corrupt data being synced from iCloud or other sources (gmail, Windows Live, Yahoo, etc).
    The simple test is to restore the phone as New. Do not create any email accounts. Do not install any apps. Do not enable FaceTime or iMessage. Do not enable Twitter or any other social networking app. Use it for a day and check the battery usage. You will find that it is working well.
    And also see this: http://www.overthought.org/blog/2014/the-ultimate-guide-to-solving-ios-battery-d rain. It is the best treatise I have seen on the subject of battery usage.

  • How do i get my ipod to enable again? it said my i need to put the pass code in my i pod but the reason why its disabled is because i forgot my  password so what can i do

    how do i get my ipod to be enabled again? i plugged it in and it said it cant enable because i need to put the passcode in and thats how it got disabled beacause i forgot my passoword what can i do now??

    Hi cinnamon,
    Follow the instructions in this article (specifically the instruction in the "Note" in section 1).
    Cheers,
    GB

  • Update to 7.1.2 but no space? Update says it's 22.2 MB, but tells me that. Need 1.0 GB of space? I have 613 MB free, why won't it update? I don't want to delete that much. Maybe the entire IOS 7 needs that much space, not just the update?

    Why does copy and paste not work here?  I'll type again:
    update to 7.1.1 says it's 22.2 MB.  Why does it require 1.0 GB to install? I have just 613 MB free.

    With so little Available storage space, you are risking poor operation of the iPad. You should free up more space.
    iPhone, iPad, and iPod: Understanding capacity
    http://support.apple.com/kb/ht1867
    How much space is used by your Other? You may be able to reduce.
    How Do I Get Rid Of The “Other” Data Stored On My iPad Or iPhone?
    http://tinyurl.com/85w6xwn
    How to Remove “Other” Data from iPhone, iPad and iPod Touch
    http://www.igeeksblog.com/how-to-remove-other-data-from-iphone/
    With an iOS device, the “Other” space in iTunes is used to store things like documents, settings, caches, and a few other important items. If you sync lots of documents to apps like GoodReader, DropCopy, or anything else that reads external files, your storage use can skyrocket. With iOS 5/6/7, you can see exactly which applications are taking up the most space. Just head to Settings > General > Usage, and tap the button labeled Show All Apps. The storage section will show you the app and how much storage space it is taking up. Tap on the app name to get a description of the additional storage space being used by the app’s documents and data. You can remove the storage-hogging application and all of its data directly from this screen, or manually remove the data by opening the app. Some applications, especially those designed by Apple, will allow you to remove stored data by swiping from left to right on the item to reveal a Delete button.
    What is “Other” and What Can I Do About It?
    https://discussions.apple.com/docs/DOC-5142
    iPhone or iPad Ran Out of Storage Space? Here’s How to Make Space Available Quickly
    http://osxdaily.com/2012/06/02/iphone-ipad-ran-out-of-available-storage-space-ho w-to-fix-quick/
    6 Tips to Free Up Tons of Storage Space on iPad, iPhone, and iPod Touch
    http://osxdaily.com/2012/04/24/6-tips-free-up-storage-space-ipad-iphone-ipod-tou ch/
    Also,
    How to Clear Message/iMessage Cache on iPhone & iPad And Reclaim Lots of Free Space
    http://www.igeeksblog.com/how-to-clear-message-imessage-cache-on-iphone-ipad/
    What is Stored in iCloud and What is Not
    https://sites.google.com/site/appleclubfhs/support/advice-and-articles/what-is-s tored-in-icloud
     Cheers, Tom

  • How do I create my own favorite template for DVD slideshows? I used to be able to select this from pulldown menu, but cannot now do so. I am directed straight to templates, which take more memory. I have a large slideshow, and need all the space I can get

    First, how do I create my own favorite theme template for DVD slideshows? I used to be able to select this from pulldown menu, but cannot now do so. I am directed straight to already existing themes, which take more memory. I have a large slideshow, and need all the space I can get. I just want to use a picture as my DVD cover, and then insert a slideshow. Also, when I try to burn my 8.5gb double sided slideshow, all that burns is the music. It is a large slideshow, a memorial on the life of my now deceased brother. This means a lot to me and to my family, and I am having so much trouble trying to burn it. I have gone into Project View and selected appropriately. The bar shows I have room to burn this DVD, but it does not burn.  I have burned so many DVDs in the past, but this one just will not burn. I am so confused at this point. I will say this is the first 8.5gb I have attempted to create and burn. My specs list a 7.7gb or 4.7gb as operable....but there are no 7.7gb dvds. I had to purchase 8.5gb. Help? What am I doing wrong? I have spent so much time on this, and just cannot figure it out.

    Final Cut is a separate, higher end video editor.  The pro version of iMovie.
    Give iPhoto a look at for creating the slideshow.  It's easy to assemble the photos in an album in iPhoto, put them in the order you want and then make a slideshow of them.  You can select from various themes and transitions between slides and add music from your iTunes library.
    When you have the slidshow as you want use the Export button at the bottom of the iPhoto window and export with Size = Medium or Large.
    Save the resulting Quicktime movie file in your Movies folder.
    Next, open iDVD, choose your theme and drag the QT movie file into the menu window being careful to avoid any drop zones.
    Then follow this workflow to help assure the best qualty video DVD:
    Once you have the project as you want it save it as a disk image via the File ➙ Save as Disk Image  menu option. This will separate the encoding process from the burn process. 
    To check the encoding mount the disk image, launch DVD Player and play it.  If it plays OK with DVD Player the encoding is good.
    Then burn to disk with Disk Utility or Toast at the slowest speed available (2x-4x) to assure the best burn quality.  Always use top quality media:  Verbatim, Maxell or Taiyo Yuden DVD-R are the most recommended in these forums.
    The reason I suggest iPhoto is that I find it much easier to use than iMovie (except for the older iMovie 6 HD version).  Personal preferences showing here.

Maybe you are looking for

  • Widgets are broken / missing

    after my last apple software update, most of the standard widgets that come built into dashboard have gone haywire. in the 'widgets' widget (the one that allows you to turn widgets on and off, sort by date, etc.), the standard apple widgets, such as

  • What is maximum length of CAT5e cable that HH3 can...

    The wireless signal is weak in our home office in the garden so I installed a CAT5e cable to give me a LAN connection to the computer.  The cable is 30 m long and I have checked the connections (from the LAN connection lead into the router to the con

  • Installer Error Message with Adobe Pro IX

    I have tried several times to download Adobe Pro IX with no success.  Today I keep getting an error message that states the installer is misconfigured.  Tried to download new installer and just keep getting the same error message.  I checked the syst

  • Dynamic Column Query

    Hi Friends, Can you please help me in writing a query for : YEAR PRODUCTION QLY_TYPE 1991 23 A 1991 12 B 1991 19 K 1992 23 A 1992 25 B 1992 23 K 1993 27 A 1995 12 B 1993 16 K 1994 42 A 1995 53 A 1994 40 A Query : Statistics on total production for la

  • Binding Factory Class

    Dear people, I am relatively new in Oracle JDeveloper ( using it last 3 months ) and during my last task I am facing a problem to which i can not find the solution... I am trying to set up a factory class from which i will get a Dynamic Table Binding