Help!!!  I need to hand homework tomorrow!!!

Hi!!!
Im doing my first Java assignment and Im having lots of trouble. I finally got to compile it, but when I run it red text below (which I don't understand) appears in the bottom window!!!
Here is the program and the text that appears in the bottom... PLEASE HELP ME!!
* T?tulo: Detecci?n de palabras capic?as
/** La persona digita la palabra que desea evaluar. Luego se cuenta cuantas
* letras tiene la palabra, el resultado se guardar? en una variable "F".
* La variable "I" se inicializa en 1. Posteriormente mediante un while, se compara la
* letra que est? en la posici?n I con la que est? en posici?n F, si son iguales se
* contin?a. Al finalizar si todas las letras coinciden entonces se indica, o si no se
* hace lo mismo con el contrario.
import javax.swing.JOptionPane;
public class capic?a {
public static void main(String[] args) {
String palabra = JOptionPane.showInputDialog ("Introduzca la palabra que desea evaluar"); //esta es la hilera donde van las letras de la palabra
int letra; //variable entera donde se almacena lo introducido
//una vez transformado en hilera
int I = 0; //variable que servir? para llevar la cuenta y comparar
int F = palabra.length(); //n?mero de letras de la palabra introducida
while ( palabra.charAt(I)== palabra.charAt(F) && (F > I))
{   F = F - 1;
I = I + 1;
//num= Integer.parseInt(hnum));
if (F <= I) {
System.out.println("si es pal?ndroma");
}else{
System.out.println("no es pal?ndroma");
This is what appears in the box which is called Interactions
Welcome to DrJava. Working directory is -----------------------------
java capic?a StringIndexOutOfBoundsException: String index out of range: 5
at java.lang.String.charAt(Unknown Source)
at capic?a.main(capic?a.java:28)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
>
Message was edited by:
anatel

I havn't really followed what's going on, but if you are asking how to remove spaces from a string, call the split() method on the string. This returns an array of the parts of the string that arn't spaces.
e.g.
String test "this is a test string";
String[] words = test.split();
for (int i = 0; i < words.length; i++)
  System.out.println(words);
[i]untested
This should print:
this
is
a
test
string                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • HT201210 i try to do several times... to recovery my ipad 2 wifi...but it gone off mode..what i must do.. i'm  university student ..i need my ipad for tomorrow lecture..please help me

    i try to do several times... to recovery my ipad 2 wifi...but it gone off mode..what i must do.. i'm  university student ..i need my ipad for tomorrow lecture..please help me

    What version of ios do you have?
    See Texas Mac Man's write up here.
    My iPad won't connect to my home wifi - even though it has previously worked fine.  It says it is unable to connect? - any ideas

  • Please help! i have just upgraded to an iphone 5 for work, so i have started to backup my iphone 4 but it is stuck on 'finishing sync' and has been for 20hours!what can i do?i need it for work tomorrow

    please help! i have just upgraded to an iphone 5 for work, so i have started to backup my iphone 4 but it is stuck on 'finishing sync' and has been for 20hours!what can i do?i need it for work tomorrow

    Is this what you downloaded: iTunes 10.7?
    When the update fails what if any error report do you get, specifically? Please do this before trying again:
    Repair the Hard Drive and Permissions
    Boot from your Snow Leopard Installer disc. After the installer loads select your language and click on the Continue button. When the menu bar appears select Disk Utility from the Utilities menu. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the installer.
    If DU reports errors it cannot fix, then you will need Disk Warrior and/or Tech Tool Pro to repair the drive. If you don't have either of them or if neither of them can fix the drive, then you will need to reformat the drive and reinstall OS X.

  • I need help with a second hand iphone i purchased recently,i am having issues setting it up as it has is requesting for the icloud account that was used by the previous user

    i need help with a second hand iphone i purchased recently,i am having issues setting it up as it has is requesting for the icloud account that was used by the previous user

    Sorry.
    The iPhone is of no use until/unless the previous owner removes it from their account.
    You will need to find the prior owner or return the iPhone.

  • HT4061 i cant activate my iphone 5c because it has been locked with a different apple id. i dont know the original owner so i need help. its a second-hand phone that i bought some months back

    i cant activate my iphone 5c because it has been locked with a different apple id. i dont know the original owner so i need help. its a second-hand phone that i bought some months back

    Unfortunately, there is pretty much nothing you can do. Only the owner of the account used to lock it can remove the lock. If you can't contact whoever you purchased it from, or if they can't or won't remove the lock, then it's a brick. There is a very real chance that it's stolen.

  • I recently purchased a Canon 7D. I own Adobe Photoshop/Bridge CS5. I cannot open my raw images in Bridge. I have tried to download the plug in but does not seem to work. Please Help, I need to be able to open my raw images in Bridge ASAP. I do not want to

    I recently purchased a Canon 7D. I own Adobe Photoshop/Bridge CS5. I cannot open my raw images in Bridge. I have tried to download the plug in but does not seem to work. Please Help, I need to be able to open my raw images in Bridge ASAP. I do not want to upgrade to CS6 at this time.

    If you had given us sensible information, I could look it up for you if your efforts fail.
    Right now, I don't even know if you are on a Mac or on a Windows box.
    BOILERPLATE TEXT:
    If you give complete and detailed information about your setup and the issue at hand, such as your platform (Mac or Win), exact versions of your OS, of Photoshop and of Bridge, machine specs, what troubleshooting steps you have taken so far, what error message(s) you receive, if having issues opening raw files also the exact camera make and model that generated them, etc., someone may be able to help you.
    Please read this FAQ for advice on how to ask your questions correctly for quicker and better answers:
    http://forums.adobe.com/thread/419981?tstart=0
    Thanks!

  • My phone 5s did the new update and will not come back on. I already tried hard reboot still won't work. Been over a hour now. Please someone help I need my phone.

    My phone 5s 16gb gold did the new update and will not come back on. I already tried hard reboot still won't work. Been over a hour now. Please someone help I need my phone.   This phone is not even 6 months old been in case no scratches. This is driving me crazy.

    Connect your phone to a computer and restore your software using iTunes.

  • In the new mail app for OSX v10.7 Lion it seems I can only setup my gmail account as an "imap", when I need to set it up as "pop"... PLZ HELP I NEED MY MAIL TO WORK!!!

    In the new mail app for OSX v10.7 Lion it seems I can only setup my gmail account as an "imap", when I need to set it up as "pop"... PLZ HELP I NEED MY MAIL TO WORK!!!

    Go to System prefs
    Select Mail Contacts and Calendars
    Then select Other
    Then select "Add a Mail Account and click create
    Then go to google for the settings you need:
    First here for the settings online at gmail http://tinyurl.com/du3fu
    Then here for the setting in mail http://tinyurl.com/38fevm8
    These are instructions for Mail 4.0 but all of the necessary settings should be listed.

  • Help, I need to run three displays on my Mac Pro 4,1.

    Help, I need to run three displays on my Mac Pro 4,1.
    I have a Radeon 5870 installed with OS X 10.8.3
    need to run a Dell 30 inch dislay, a 19 inch Eizo and a 12 inch Cintiqu Display Tablet please.
    Ant tipes or hints?  Failing that, I would like to know of a comptaible video/graphic card which will only take up an additional slot, as I have the others filled with eSata and USB 3 cards.
    Cheers
    David

    Your 5x70s support three monitors. Are you having trouble?
    Answered just last night in this thread also
    https://discussions.apple.com/thread/4933924?tstart=0

  • Windows XP Clean Install – What I discovered and the help I need

    Windows XP Clean Install – What I discovered and the help I need
    I previously had a problem with my Laptop dying randomly you can read about it in the thread entitled Computer dies Randomly (Battery also dead) click to view
    Before I realised the solutions, I thought that maybe my Laptop had become infected with a Virus and decided it would be prudent to do a clean install of the Windows XP operating system.
    Everything went perfectly and thought a clean install was a good opportunity to download the “XP Service Pack 3” SP3 and did so, it seemed very quiet though and that’s when I realised I had no sound…
    I downloaded all of the sound drivers I could find on the Lenovo site for 3000 N100 (I knew from previous experience that the “SOUNDMAX” driver is the only one that actually works with this 3000 N100) in order to install this you have to install the Realtek HD audio driver, but in order to install that you have to install some other Driver/Soft that only works with SP1 or SP2 if you try to install it with SP3 it will say that you don’t need the file as your Service pack is newer than the file you want to install, this is understandable as SP3 is not final as of yet (but it’s good to know).
    My next problem was that my extra RAM was not detected, this was fixed by updating the BIOS, after installing all of the System updates, PC Doctor, everything I could find for 3000 N100 I decided to rest, I pushed the Lenovo care button and it did not work, I found a hot key driver and installed it but still the Lenovo care button does not work, previously when I pushed this button it would bring up the Lenovo menu but now it’s just a dead button, Does anyone know how to get this button working again?
    I am pretty sure that everything else is working fine now, just that button not working is very annoying, is there a set routing of installs you must do to get everything working, i.e. bios 1st audio 2nd system update 3rd etc...
    Please help, I hope I have helped you...
    Message Edited by DrunkenNinja on 05-07-2008 03:38 AM
    Message Edited by DrunkenNinja on 05-07-2008 03:38 AM
    Solved!
    Go to Solution.

    Ok first everything works now... except the Lenovo Care button, I just posted the other stuff cause it might help other members,  I have searched the forum for an anwser to this problem but there was only one anwser (suggesting to uninstall the driver restart and re-install it) and it did not result in a working Lenovo Care button...
    I don't beleive the Lenovo keyboad drivers are in any way related to the Service pack 3 as they do not use the Service pack files, to back this up I also had the same problem when Service Pack 2 was installed...
    The Lenovo Care button works fine on Boot up screen to access the rescue and recovery software (So the mechanics of the button are fine) but once Windows XP loads it is just a dead button, I remember it used to open up the Lenovo Care Start bar, I got it working once in the past but I can't remember what I did, I thought someone here might know the anwser...

  • I have a new Ipad and when I try to buy an app it asks for my  questions! I dont remember them so I press the button that send me an email to reset them. Ive sent it various times but it doesnt arrive. please help I need this app for school!!!

    I have a new Ipad and when I try to buy an app it asks for my  questions! I dont remember them so I press the button that send me an email to reset them. Ive sent it various times but it doesnt arrive. please help I need this app for school!!!

    See Kappy's great User Tips.
    See my User Tip for some help: Some Solutions for Resetting Forgotten Security Questions: Apple Support Communities https://discussions.apple.com/docs/DOC-4551
    Rescue email address and how to reset Apple ID security questions
    http://support.apple.com/kb/HT5312
    Send Apple an email request for help at: Apple - Support - iTunes Store - Contact Us http://www.apple.com/emea/support/itunes/contact.html
    Call Apple Support in your country: Customer Service: Contacting Apple for support and service http://support.apple.com/kb/HE57
     Cheers, Tom

  • I am using windows 7 and itunes 11.7 my i phone 5s is not getting synced with my laptop it keeps showing backing up  please help i need to put music in my phone?

    i am using windows 7 and itunes 11.7 my i phone 5s is not getting synced with my laptop it keeps showing backing up  please help i need to put music ?

    Hi,
    Have you managed to solve this problem? if yes, please highlight how you solved it...i'm facing same problem with my new Iphone 5S but udner Windows, thanks.

  • My BB9810 refuse to load OS7.1 software on my phone after the download has completed. My phone has freezed/stucked since morning. Pls urgent help/assistant needed as I can not access/use my phone for over 24hrs now.

    My BB9810 refuse to load OS7.1 software on my phone after the download has completed. My phone has freezed/stucked since morning. Pls  urgent help/assistant needed as I can not access/use my phone for over 24hrs now.

    Hi there,
    Use the method described in the link below to get back up and running:
    http://supportforums.blackberry.com/t5/Device-software-for-BlackBerry/How-To-Reload-Your-Operating-S...
    I hope this info helps!
    If you want to thank someone for their comment, do so by clicking the Thumbs Up icon.
    If your issue is resolved, don't forget to click the Solution button on the resolution!

  • Help urgently needed, I have installed Logic Pro 9, since then my Final Cut Pro X keep freezing. Anyone what is wrong and how to solve it? I desperately need help on this. Thanks

    Help urgently needed, I have installed Logic Pro 9, since then my Final Cut Pro X keep freezing. Anyone what is wrong and how to solve it? I desperately need help on this. Apple support says I have to pay £85 for to help me. Thanks

    Just a word of advice. Never ever use the word "urgent" on this forum

  • Please Help , I Need semicolon ; after TABLESPACE "MFEED_DATA"

    Hi All,
    please Help , I Need semicolon ; after TABLESPACE "MFEED_DATA"
    as I am getting ; like below example
    select dbms_metadata.get_ddl('TABLE', 'A') || ';' As Result
    from dual;
    CREATE TABLE "MFEED"."A"
    (     "A" NUMBER
    ) PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
    STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
    PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
    TABLESPACE "MFEED_DATA"
    regards,

    Hi,
    well, I don´t know if this works for any table, but I tried two of mine and it was ok:
    select substr(dbms_metadata.get_ddl('TABLE', '<table_name>'), 1,
    length(dbms_metadata.get_ddl('TABLE', '<table_name>') || ';')-4)|| ';' As Result
    from dual;
    If the string gets too long, you must use dbms_lob - functions for string manipulation, but for "normally sized" tables, it should work.
    Regards,
    Gerd
    Message was edited by: Gerd
    OK, Jens has the perfect solution - forget mine!
    gerd_99

Maybe you are looking for

  • Can you include an external data source in query condition?

    Hi all, I have a user that wants to run a report off a subset keys in an external data source. Is this possible in Disco Plus? For example, he has an Excel file that is just a list of employee numbers. He then wants his Disco query to only bring back

  • Tab opens in new window by itself

    I have several tabs open that I switch between, one of them being Facebook, and that is the only one that ever gives me issues. Sometimes when switching between tabs, the Facebook tab pulls itself out of the group, and into it's own new window, and I

  • Business Catalyst premium partner and CC

    I am a BC premium partner with CS5.5 and was thinking of upgrading to CC.  My worry is I don't want to lose all my sites that i created with BC over the last 2 years.  Is this upgrade to CC a seemless one or is there issues with BC and CC?? I dont ca

  • SO_NEW_DOCUMENT_ATT_SEND_API1 pdf attachment sending thru mail ecc 6.0

    Hi All, I'm using ECC 6.0 version, I'm trying to attach a pdf file to a mail using the function module SO_NEW_DOCUMENT_ATT_SEND_API1. But gtting error as "wasn't decoded correctly", but the same coding is working fine in 4.6 version. What changes i s

  • HT201272 Hi I puchased a few songs and for some reason they have been deleted from my computer.  Can you help me

    I purchased  Karma yoga by yoga specialists from the pure yoga moods album,  Om by Wade Irme Morrissette,  Sattvam on Asana 2,  Ganesh Mahatmantra on Sacred morning chants.   They have all be errased from my computer.  Is there any way someone can he