Infinate loop plus error

Hey im workin on a program right now which has a user enter a sentance to and if it has any (taboo words) words that cannot be entered into the sentance the sentance gets rejected. It compiles but it always says that there are no taboo words when i type some in as well I looked this over for a while and i cant see to find a problem with it so any help would be great
import java.util.*
public class MilitaryCensor
private String [] taboo = {"hermes", "muddy", "river", "assault", "bridge", "offensive"};//list of words that cant be used in a message
private String sentances;//variable which holds the sentance the user enters
private String tokenizer;
public MilitaryCensor()
entersentance();
nextToken();
public void entersentance()//this method just has the user enter a sentance
Scanner input = new Scanner(System.in);
System.out.println("Enter a message");
sentances = input.nextLine();
public void nextToken()
StringTokenizer sentance = new StringTokenizer(sentances.toLowerCase());
while(sentance.hasMoreTokens()){
for(String taboos : taboo){//tests each word to see if its a taboo word (word that cant be used) and if it is it gets rejected if not its ok
if(sentances.equals(taboos)){
System.out.println(sentances + " >>>>> Rejected");
break;//breaks out of the while loop if it finds one of the taboo words before the end because it knows not to continue.
else{
System.out.println(sentances + " >>>>> Ok");
break;
}

import java.util.*;
public class MilitaryCensor
    private String [] taboo = {"hermes", "muddy", "river", "assault", "bridge", "offensive"};//list of words that cant be used in a message
    private String sentances;//variable which holds the sentance the user enters
    private String tokenizer;
    public MilitaryCensor()
        entersentance();
        nextToken();
    public void entersentance()//this method just has the user enter a sentance
        Scanner input = new Scanner(System.in);
        System.out.println("Enter a message");
        sentances = input.nextLine();
    public void nextToken()
      StringTokenizer sentancetokenizer = new StringTokenizer(sentances.toLowerCase());
      while(sentancetokenizer.hasMoreTokens()){
          for(String tabootester : taboo){//tests each word to see if its a taboo word (word that cant be used) and if it is it gets rejected if not its ok
              if(sentancetokenizer.nextToken().equals(tabootester)){
                  System.out.println(sentances + " >>>>> Rejected");
                  break;//breaks out of the while loop if it finds one of the taboo words before the end because it knows not to continue.
                else{
                  System.out.println(sentances + " >>>>> Ok");
                 break;
} I changed my variables around sentance is now sentanceTokenizer and taboos is now tabootester and thanks for lettin me know about the code thing alot better now

Similar Messages

  • HT1414 My Ipad is stuck in an " infinate loop" It goes from the" loading"( white apple on screen) to openning screen. I can slide but can't enter pass code. I let it drain the battery, no good. I have held the buttons, no good, can't enter the pass code

    My Ipad is stuck in an "infinate loop" it goes from the "loading" (white apple) to the openning screen. I can slide to the passcode entery screen but it will not take the passcode. ( when I type it it does not recognize on the screen)

    I suggest try getting it back to your stock iOS and forget about jailbreaking.
    http://support.apple.com/kb/TS1538
    Try a manual install (using DFU Mode), as outlined in the link below.
    Basic troubleshooting steps  
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 
    Got problems with your Apple iDevice-like iPhone, iPad or iPod touch? Try Troubleshooting 101
     In Memory of Steve Jobs 

  • My iphone is stuck in recovery mode. now almost three weeks in recovery mode. plus error 4005 4013 4014 what is the solution?

    my iphone is stuck in recovery mode. now almost three weeks in recovery mode. plus error 4005 4013 4014 what is the solution?

    Hi there Kiyya,
    You may find the information in the article below helpful.
    iOS: Restore errors 4005, 4013, and 4014
    http://support.apple.com/kb/TS5314
    -Griff W. 

  • My ipod is stuck on connect to itunes i think its in a loop. plus it wont turn on unless its connected to a power source.

    my ipod touch is stuck in a connect to itunes loop, plus it wont turn on unless its conneted to a power source. how could i fix this.

    Maybe:
    Restore loop (being prompted to restore again after a restore successfully completes)
    Troubleshoot your USB connection. If the issue persists, out-of-date or incorrectly configured third-party security software may be causing this issue. Please follow Troubleshooting security software issues. .
    Next try placing in DFU mode and then restoring.
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    Then try restoring on another computer.
    Last, make an appointment at the Genius Bar of an Apple store since it appears you have hardware problem.
    Apple Retail Store - Genius Bar

  • Tough question - serialization cause infinate loop ?

    If two objects with non-"transient" references to each other are serialized using ObjectOutputStream, will this create an infinite loop?
    i saw this question posted on another forum and I had no freakin idea :=) but im curious does it ?
    how can you get into an infinate loop situation while using ObjectOutputStream and serialization

    Come on now. The people at sun are a bit smarter than that. If an object has already been serialized to a stream, the stream will not re-serialize it, it will just insert a reference to the objects position earlier in the stream.
    so for example
    class A implements java.io.Serializable {
       private B b;
    class B java.io.Serializable {
       private A a;
    }Serializing an instance of A gives this (approx.):
    A{b=B{a=|}}
    |       |
    |-<--<--|

  • Oracle 8i Lite Sql*Plus error

    When attempting to connect to Sql*Plus I get
    the error ORA-21526 in an infinite loop.
    Any ideas how to get around it?
    I am running under Windows 98.
    null

    debbie (guest) wrote:
    : When attempting to connect to Sql*Plus I get
    : the error ORA-21526 in an infinite loop.
    : Any ideas how to get around it?
    : I am running under Windows 98.
    Check the NLS_DATE_FORMAT to make sure it is set up correctly.
    null

  • Sql*plus error while executing

    Hi ,
    Note : "I am in unix terminal in sql*plus prompt running this below query"
    SQL> declare
    v_len number(9);
    v_sublen number(9);
    v_resval number(9);
    v_cnt number(9):=1;
    v_parm varchar2(600):='&peo_no';
    begin
    select length(v_parm) into v_len from dual;
    for i in 1..v_len loop
    select substr(v_parm||',',v_cnt, instr(v_parm||',',','))
    into v_resval
    from dual;
    select length(v_resval) into v_sublen from dual;
    insert into t(col)values(v_resval);
    v_cnt:=v_cnt + (v_sublen+2);
    end loop;
    end;
    / 2 3 4 5 6 7 8 9 10 11 12 13 14 14 15 16
    17 18
    Enter value for peo_no: 123,456,789,852,147,369
    old 6: v_parm varchar2(600):='&peo_no';
    new 6: v_parm varchar2(600):='123,456,789,852,147,369';
    declare
    ERROR at line 1:
    ORA-01722: invalid number
    ORA-06512: at line 10
    It's getting the error above pls anyone suggestions
    Thanks,

    You don't have to use a for loop to do the job, which is a slow process. try this instead.
    PRAZY@11gR2> select * from t;
    no rows selected
    Elapsed: 00:00:00.00
    PRAZY@11gR2>
    declare
         v_parm varchar2(600):='&peo_no';
    begin
         insert into t select case when level = 1 then
              substr(v_parm,1,instr(v_parm,',')-1)
         when level = length(v_parm) - length(replace(v_parm,',')) + 1 then
              substr(v_parm,instr(v_parm,',',-1)+1,length(v_parm) - length(substr(v_parm,1,instr(v_parm,',',-1))))
         else
              substr(v_parm,length(substr(v_parm,1,instr(v_parm,',',1,level-1)))+1,
              length(substr(v_parm,1,instr(v_parm,',',1,level))) - length(substr(v_parm,1,instr(v_parm,',',1,level-1))) - 1)
         end
         from dual
         connect by level <= length(v_parm) - length(replace(v_parm,',')) + 1;
         commit;
    end;
    Enter value for peo_no: 85232,456256,324562,89654
    old   2: v_parm varchar2(600):='&peo_no';
    new   2: v_parm varchar2(600):='85232,456256,324562,89654';
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.04
    PRAZY@11gR2> select * from t;
           COL
         85232
        456256
        324562
         89654
    Elapsed: 00:00:00.00
    PRAZY@11gR2>Btw, I had never seen a Oracle 7 DB. I thought it was RIP. ;)
    Note: Posted this on your other thread.. this is just in case... :)
    Regards,
    Prazy

  • Office 2013 Professional Plus - error 1653

    Hi
    I tried to install Office 2013 Professional Plus 64 bit on my Windows 8.1 Update 1 pro 64 bit Lenovo Thinkpad E530.
    The MSI crashes after I deselected Lync and OneDrive for Business and selected Organigram for Powerpoint with the error code 1653 showing up on my Event Log.
    The message in my Event Log looks like this:
    - <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
    - <System>
    <Provider Name="Windows Error Reporting" />
    <EventID Qualifiers="0">1001</EventID>
    <Level>4</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2014-07-27T06:01:00.000000000Z" />
    <EventRecordID>24997</EventRecordID>
    <Channel>Application</Channel>
    <Computer>sun</Computer>
    <Security />
    </System>
    - <EventData>
    <Data>90226236923</Data>
    <Data>5</Data>
    <Data>OfficeClassicSetup</Data>
    <Data>Not available</Data>
    <Data>0</Data>
    <Data>15.0.4454.1000</Data>
    <Data>OSETUP.DLL</Data>
    <Data>15.0.4569.1503</Data>
    <Data>1653</Data>
    <Data>Unspecified</Data>
    <Data>FC73469E</Data>
    <Data>1653</Data>
    <Data />
    <Data />
    <Data />
    <Data>C:\Users\Wenger\AppData\Local\Temp\SetupExe(2014072708001915DC).log C:\Users\Wenger\AppData\Local\Temp\SetupExe(201312051053101B60).log C:\Users\Wenger\AppData\Local\Temp\SetupExe(2014072707211315A8).log C:\Users\Wenger\AppData\Local\Temp\SetupExe(201407270727311814).log C:\Users\Wenger\AppData\Local\Temp\SetupExe(201407270734471130).log C:\Users\Wenger\AppData\Local\Temp\SetupExe(201407270741391118).log C:\Users\Wenger\AppData\Local\Temp\SetupExe(201407270748481BB0).log C:\Users\Wenger\AppData\Local\Temp\SetupExe(2014072708001915DC).log</Data>
    <Data>C:\ProgramData\Microsoft\Windows\WER\ReportArchive\Report_15.0.4454.1000_df68ca3f8edd6e5681e49fd7574098be8eb1ae_00000000_15d80367</Data>
    <Data />
    <Data>0</Data>
    <Data>5d904862-1553-11e4-beae-b888e3ddd920</Data>
    <Data>0</Data>
    <Data>d2963090adfe06bdd11d2f48d5050f44</Data>
    </EventData>
    </Event>
    What I've tried so far:
    Used several fixitTools
    Office 2007 Suite:
    http://support.microsoft.com/kb/928218#Method2
    Office 2010 Suite:
    http://support.microsoft.com/kb/290301#Method2
    And of course
    Office 2013 Suite:
    http://support.microsoft.com/kb/2739501
    I even executed this PowerShell script to ensure that Rollback is disabled and the Microsoft Helper is deleted
    http://gallery.technet.microsoft.com/office/How-to-fix-Office-af646d16
    Note that my Microsoft Helper folder was not even there before I run the script.
    The Rollback was enabled as I checked and I checked manually for another or the same installation to be listed in the Program Settings.
    After several Reboots and run as Administrator and frustrations I came to you.
    Could you help me please?
    Thanks in advance
    For additional information, I of course share them with you.

    Hi,
    The description of error 1653 is that you could not perform a multiple-package transaction because rollback has been disabled. Multiple-Package Installations cannot run if rollback is disabled. Available beginning with Windows Installer version 4.5.
    According to error code 1653, I find a similar question about it. I address it here, you can follow Micrey’s suggestion to check if it works.
    http://social.technet.microsoft.com/Forums/office/en-US/f6501a3d-5c98-467b-9f48-3c6d20a454df/microsoft-office-professional-2013-encountered-an-error-during-setup?forum=officesetupdeploy
    “The issue when you hit a "1653" is that Windows Installer "DisableRollback" is set. Office 2013 requires that "rollback" be enabled. If you are getting a "1653" error in your logs as Ken did then the solution is to delete the "DisableRollback" (or set to
    '0') at the following registry keys:
    HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Installer
    HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Installer”
    Regards,
    Greta Ge
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

  • HP Officejet Pro 8500A Plus (Error E0060)

    I have a HP Officejet Pro 8500A Plus and when I power it up it shows the HP logo on the screen then the paper feed starts to run then it stops and I get a message saying  "Unable to send or recieve fax" then it says Error E0060. Then the another message saying to turn the power off then on again and the screen flashes.  Now the printer isn't connected to the computer  and I have not put any paper in it. I would like to know what is wrong with it. What do I need to fix it, and how much would it cost to get this lovely printer fixed?

    Hi Rossainz,  I don't know that I can answer 'what is wrong with it', but I would be happy to help you figure it out and better yet, resolve the issue. Let's first try leaving the printer on and unplugging the power cable out of the back. Leave it unplugged for a full minute during which time you can hold down the power button for just a few seconds to help release and build up power, then plug the power cable back in.  If the issue persists, please let me know and we will see what other solutions might do the trick.

  • Clear Screen, Sql plus Error, in release 10.2.0.1.0

    Hi there,
    I'm having problem in using clear screen command in SQLPlus utility of Oracle Release 10.2.0.1.0. When executing clear screen in SQL Plus ( in command prompt) in windows machine, suddenly a dialogue box opens and saying that "SQLPlus encountered an error and sorry for inconvenience "
    Is this the problem with OS or Oracle Client?
    Could anyone please help me in resolving this issue?
    Thanks
    Raja

    So that is the problem with Oracle client only, not with the OS configuration and all.... shall i assume?

  • Iphone 4 in retire recovery mode loop unknown error (9)

    My iphone 4 will not restore.. It goes so far and the I get a message- your iphone cannot be restored - unknown error (9). It is in a loop in recovery mode. I have tried it on my iMac and a windows laptop. Same problem

    And you have done all include here?
    http://support.apple.com/kb/TS3125

  • JMeter ThreadGroup Looping cause error- JBO-35007: Row currency has changed

    Hi all,
    Still Stress testing ADF Faces with JMeter,
    I try to simulate each user inserting multiple rows by setting Loop Count = nn on a JMeter Thread Group :
    Test Plan
    Thread Group
    Http Cookie Manager
    Once Only Controller
    1) MainMenu.jspx
    2) Login
    3) SalesMenu
    ***** end of Once Only Controller
    4) Add New Order -> this will open a blank Form after a new row is Inserted
    5) Submit the Form -> this will do entity validation
    6) Press Commit
    7) Back to SalesMenu
    *** end of test plan
    As you see, by using Once Only Controller, I want the looping of inserting new Order starts from step 4)
    But on step 5) I get the error :
    JBO-35007: Row currency has changed since the user interface was rendered.
    The expected row key was oracle.jbo.Key[-3649]
    Is ther any work around for this ?
    Thank you for your help,
    xtanto

    Hi Chris,
    Thank you for your reply
    A) is it the first iteration of the loop it fails? If not which iteration?
    No, first iteration is successfull, error occured on iteration-2.
    B) number 7, when you say back to the sales menu, by what means? Via browser back button?
    Not via back button, I do it using Global Navigation rule from action propeerty of <af:commandMenuItem
    C) your sales menu, does it use af:command controls or af:go controls?
    From SalesMenu to AddOrderPage -> using <af:commandMenuItem
    D) the number -3469. Is it familiar to you? A number you're generating via I'm curious to know why it's negative.
    Yes, negative is expected, its because I use DBSequence as PK, and on entering the AddOrderPage, a new Row is created, when created by ADF the PK is negative,
    then using a DB Before Insert Trigger I update it with a normal sequence.
    Does iteration / looping work in your case ?
    Thank you very much,
    xtanto.

  • For Each Loop: Truncation error on excel field

    In my SSIS package, I'm using a WMI file watcher combined with a ForEach loop to process excel files and load them into a SQL Server database as they are deposited in a drop box folder. Recently I've been getting truncation errors on one of my fields (Comments).
    I know that this is because Excel is scanning the first 8 rows to determine column length and there are several records that have a comments field that is greater than what excel determined.
    I've tried going to the excel editor in my advanced editor and setting the data type length of my external and output columns to a larger length (500 W_STR vs 255 W_STR) but I get a warning saying that the data type is not valid. I've tried adding IMEX=1
    to my extended properties in my excel connection string but no dice. Still getting truncation errors.
    I was wondering if anyone had any thoughts or suggestions? I'm always getting new files so the comments field will potentially always encounter this type of error. This SSIS package runs on a production server so making a Registry change to the excel drivers
    regarding the scanning of the first 8 rows is not an option for me.
    Migince

    I wound up making the registry change for # of rows scanned by excel and that seemed to solve the issue.
    I tried utilizing an excel template but every time my for each loop scanned for a new file, the metadata was updated with whatever column length was in the first 8 records of my new file. If you've got a good example of building an excel template to set
    the column length metadata in my excel source (For Each Loop) I would love to take a look at it. Good information to know.

  • Re: SQL Plus Error ORA - 12560 TNS:Protocol Adapter error

    I am using Oracle 9i
    On Windows XP Home
    I am trying to learn and become familiar with Oracle 9i
    I get the above error whenever I try to log on to SQL Plus
    I use the following Id scott
    and the following Password Tiger
    and the above error comes up
    now I can't log on to Oracle9i SQL
    I tried going into Start, Control Panel, Administrative Tools, Services
    I see the Oracle SID which says Automatic, Started
    But I am unable to still logon
    Anyone has a solution
    Assistance would be appreciated
    The solution can be printed here as well as please forward a copy to [email protected]
    Thanks

    Here is the following output of your instructions
    sc query oracleserviceoracle
    SERVICE_NAME: ORACLESERVICEORACLE
    TYPE: 10 WIN32_OWN_PROCESS
    STATE: 4 RUNNING
    (STOPPABLE, PAUSABLE, ACCEPTS_SHUTDOWN)
    WIN32_EXIT_CODE: 0 (0X0)
    SERVICE_EXIT_CODE: 0 (0X0)
    CHECKPOINT: 0X0
    WAIT_HINT: 0X0
    set | find "ORACLE"
    comes back empty
    set | find "oracle"
    JSERV=J:\oracle\ora92/Apache/Jserv/conf;C:\oracle\ora92/Apache/Jserv/conf
    Path=J:\oracle\ora92\bin;C:\oracle\ora92\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\MSSQL7\BINN;"C:\Program Files\Zone Labs\ZoneAlarm\MailFrontier";C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\Executive Software\DiskeeperLite\;C:\Program Files\CA\PPRT\bin;C:\Program Files\SSH Communications Security\SSH Secure Shell;;J:\Acucobol\BIN
    WV_GATEWAY_CFG=J:\oracle\ora92\Apache\modplsql\cfg\wdbsvr.app
    ebrian
    Yes I realize that the JSERV is pointing in the incorrect are
    the J drive is a flashdrive
    In the Registry I have just deleted the 2nd Orahome directory which was on the J drive
    so all I have now left is the Orahome directory on the C drive
    how do I make corrections so that from now on the JSERV, Path, and WV_Gateway._CFG point to the C drive

  • WTF? Zen Nano Plus/Error with Ripping to portable dev

    I have ripped a cd to WMA and now have it in my PC music library. Now that it is converted, I want to drag it to my Nano Plus. Oddly enough, only some go through complete, others have an error. I have deleted and tried to rip and move song by song as well as the whole cd... What am I doing wrong?
    Please help this noob out Thanks for your time.
    Here is an screenshot....
    http://img445.imageshack.us/my.php?image=wtferror9cu.jpgMessage Edited by darklotus on 04-05-2006 08:34 PM

    darklotus,
    Did you transfer all the audio files to the root directory? Try creating folder in the player and transfer those audio files to the folder instead.
    Jason

Maybe you are looking for