The looping does not stop after a true answer, why?

"Ok, so you want to keep looping as long as the user didn't enter 1, 2, or 0, right?"
Answer: Yes that's it.
boolean repeat = false ;
do {
System.out.print(" Option 1  \nOption 2 \nOption 0" );
   int x = Integer.parseInt(br.readLine().trim());
      switch(x) {
   case 1 : System.out...etc.("test");
   case 2 : System.out...etc.("test");
   case 0 : System.out...etc.("test");
  default :  repeat = true; 
} while( repeat == true) ; Steals repeating even if u give a true answer( 1 2 or 0)
Help! :P

If you go through the loop once with something other than 0, 1, 2, then repeat will be set to true, and it will never have the possibility to be set to false again.
Each case should also set repeat to false.
You should NOT initialize repeat to false at declaration. That way, if you miss one of the repeat = false; settings in the cases, the compiler will give you an error. As you have it now, the same logic error is still present, but the compiler can't detect it.

Similar Messages

  • My MacMini does not stop after giving the order ''switch off''.What can I do?

    My MacMini does not stop after giving the order ''switch off''.
    It stops only, after pushing the button ''on/off'' for some seconds.
    What can I do?
    frahsun

    boot the Mac into safe mode, repair permissions while in it, then reboot normally.
    if that doesn't help, try resetting the System Management Controller (SMC).

  • Render engine does not stop after reaching 100%

    It looks like to me that the render engine does not stop after reaching 100%. It does not affect the rendered file which is fine and complete
    -the Pause and Stop buttons are displayed but have no effect on pausing or stoping the render
    -when I want to quit SG, it locks up and have to Force Quit to get out of it.
    I really like the program though and hope you are going to fine tune the UI and make it look like After Effect and Premiere.
    I would encourage you to instaure round tripping between these two apps and SG.
    It would be nice to have curves as well.
    Thanks guys
    Brice

    Could you open the defaultTrace.X.trc files and check for the errors?
    Good from my point of view is to make a search if those files for some stack traces with the string ".dsr."
    Regards,
    Aleksandar

  • Continuous with the problem, the headphone does not work after having my iphone ios 8.0.2 updated

    the headset does not work after having my iphone ios 8.0.2 updated to me is very annoying to have to be answering speakerphone is not private and can not go with the hands-free all the time

    I had the same issue until I updated my apps through iTunes. I had over 100 updates, but none of them showed on my iPod. After they updated everything started syncing like it is supposed. Go to the apps library and check for updates. After everything syncs leave your iPhone/ipod/ipad connected if the spinning arrows at the top is still spinning. It means that things are still being added. If you go to settings > general > about, you will see it loading songs, videos, photos, etc. If you back out of "about" and then go back to it you will see the numbers for each one change.

  • I updated to ios 7 and now the battery does not stop charging any ideas, or have to wait for update? thanks

    i updated to ios 7 and now the battery does not stop charging any ideas, or have to wait for update? thanks

    To show the battery percentage used go to settings
    from there click general scroll to usage and select
    scroll to bottom of page for battery usage select on.
    This will show the icon battery and the percent numbers on the top right.
    When phone is connected to an outlet sometimes it does not always show complete charge. I do not understand why but it is what it is.
    FYI I sent reply to you not to deggie. You can have your own satisfaction to reply direct.

  • I do I eject a blank CD stuck in my iMac 10.7.5? The CD does not appear on my desktop. Why not?

    How do I do I eject a blank CD stuck in my iMa 10.7.5? Also, the CD does not appear on my desktop. Why not?

    Here are some ways to eject it, hope this helps.
    Five ways to eject a stuck CD or DVD from the optical drive
    Ejecting the stuck disc can usually be done in one of the following ways:
      1. Restart the computer and after the chime press and hold down the
          left mouse button or track pad until the disc ejects.
      2. Press the Eject button on your keyboard at power up.
      3. Click on the Eject button in the menubar.
      4. Press COMMAND-E.
      5. If none of the above work try this: Open the Terminal application in
          your Utilities folder. At the prompt enter or paste the following:
            /usr/bin/drutil eject
    If this fails then try this:
    Boot the computer into Single-user Mode. At the prompt enter the same command as used above. To restart the computer enter "reboot" at the prompt without quotes.
    By Kappy

  • SwingWorker thead does not stop after interrupt?

    Hi,
    I am using SwingWorker class from Java Tutorial, in order to run a new task thread not in event thread. So I defined a class MyTask that extends SwingWorker, and implements construct() and finish() method (see below for SwingWorker class). Meanwhile, I use a run button to control the task run, that is, when user click the run button the new thread starts by calling MyTask.start(), but I also want to have a Cancel button to stop the task run.
    SO in my actionPerformed() for cancel button, I use the following to stop the task, but the problem is that the task does not actually stop running! Any one knows what is the reason and solution? -- Thanks!
         public void cancel() {
              if (task != null) {
                   task.interrupt();
              dispose();
         }ps: SwingWorker class from tutorial is also included here.
    public abstract class SwingWorker {
        private Object value;  // see getValue(), setValue()
        private Thread thread;
         * Class to maintain reference to current worker thread
         * under separate synchronization control.
        private static class ThreadVar {
            private Thread thread;
            ThreadVar(Thread t) { thread = t; }
            synchronized Thread get() { return thread; }
            synchronized void clear() { thread = null; }
        private ThreadVar threadVar;
         * Get the value produced by the worker thread, or null if it
         * hasn't been constructed yet.
        protected synchronized Object getValue() {
            return value;
         * Set the value produced by worker thread
        private synchronized void setValue(Object x) {
            value = x;
         * Compute the value to be returned by the <code>get</code> method.
        public abstract Object construct();
         * Called on the event dispatching thread (not on the worker thread)
         * after the <code>construct</code> method has returned.
        public void finished() {
         * A new method that interrupts the worker thread.  Call this method
         * to force the worker to stop what it's doing.
        public void interrupt() {
            Thread t = threadVar.get();
            if (t != null) {
                t.interrupt();
            threadVar.clear();
         * Return the value created by the <code>construct</code> method. 
         * Returns null if either the constructing thread or the current
         * thread was interrupted before a value was produced.
         * @return the value created by the <code>construct</code> method
        public Object get() {
            while (true) { 
                Thread t = threadVar.get();
                if (t == null) {
                    return getValue();
                try {
                    t.join();
                catch (InterruptedException e) {
                    Thread.currentThread().interrupt(); // propagate
                    return null;
         * Start a thread that will call the <code>construct</code> method
         * and then exit.
        public SwingWorker() {
            final Runnable doFinished = new Runnable() {
               public void run() { finished(); }
            Runnable doConstruct = new Runnable() {
                public void run() {
                    try {
                        setValue(construct());
                    finally {
                        threadVar.clear();
                    SwingUtilities.invokeLater(doFinished);
            Thread t = new Thread(doConstruct);
            threadVar = new ThreadVar(t);
         * Start the worker thread.
        public void start() {
            Thread t = threadVar.get();
            if (t != null) {
                t.start();
    }

    take a look to this sample.
    http://java.sun.com/products/jfc/tsc/articles/threads/threads2.html

  • Shuffle play no longer works properly and the artwork does not match after iOS5 upgrade.

    When I use shuffle play, my ipod touch stops playing after one or two songs and the artwork does not match the song. 

    i have what sounds like the exact problem; thought it might be related to a) my recent replacement phone, or b) my recent upgrade to OS 5.0.1

  • The transaction does not die after the kill and I have to restart Oracle

    Hi,
    I have this very hard issue with my production environment.
    A transaction started from java hangs after the user has closed the browser before the transaction was completed. The transaction remains in wait for "latch free" in v $ transaction.
    When the WebSphre is stopped the transaction is not closed. Neither the kill on Oracle or on Unix conclude the transaction. The restart of the DB is required.
    The rollback segment pointed to by the transaction is always the same. Although the procedure call by java is always the same.
    The database does not have performance problems and only one transaction per day waits for "latch free" and do not closed.
    The problem could be the rollback segment? Why Oracle is unable to resolve the transaction even if the client is dead and the WebSphere off?
    Regards,
    BingoBongo

    The average duration of the transaction is 10/15 seconds.
    When it lasts longer the client is closed and the transaction remains locked. But not always only in a particular case.
    From this moment the transaction is waiting for "latch free" and the value of the field USED_UBLK/USED_UREC does not increase and not decrease.
    The wait event is always the "latch free".
    The kill (Unix, Oralce) has no effect on the transaction.
    The rollback segment is always the same.
    The procedure call is always acts the same.
    The value of "SECONDS_IN_WAIT-WAIT_TIME/100" increases up to a certain point and then start over again.
    This is a snapshot of a transaction that requires restart of the DB:
    STATUS
    SECONDS_IN_WAIT-WAIT_TIME/100
    CR_CHANGE
    XIDUSN
    SECONDS_IN_WAIT
    WAIT_TIME
    STATE
    EVENT
    USED_UBLK
    USED_UREC
    OSUSER
    CLIENT_INFO
    ROW_WAIT_BLOCK#
    ROW_WAIT_OBJ#
    PROGRAM
    MODULE
    ACTIVE
    399,99
    178
    10
    400
    1
    WAITED KNOWN TIME
    latch free
    11
    738
    was5a
    0
    56204
    JDBC Thin Client
    JDBC Thin Client

  • The webpage does not load after pressing enter or CTRL+ENTER. My OS is Windows 7 Ultimate

    I have tried installing the older version Firefox 3.6. After entering the URL on address bar it does not load after pressing enter or CTRL+ENTER

    This issue can be caused by an extension (AVG Safe Search can cause this) that isn't working properly.
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    * [[Troubleshooting extensions and themes]]
    In Firefox 4 you can use one of these to start in <u>[[Safe mode]]</u>:
    * Help > Restart with Add-ons Disabled
    * Hold down the Shift key while double clicking the Firefox desktop shortcut (Windows)

  • Capture Now does not stop after the limit is exceeded........

    Hi,
    I'm using FCP HD 4.5 on a DP500 G4, OS 10.3.9. I'm doing "capture Now" to get some VHS video into my machine. FCP will not stop the capture no matter how I set the time limit. This used to work, so what did I do??
    Quite frustrating.
    I've told FCP that I'm using a "non-controllable device" but the capture just keeps on going and going and going..........
    Help......
    Pete D.
    dual 500 G4 Mac OS X (10.3.9)

    When I tell it to stop it responds and stops just fine..... if it's been going for 10 minutes I have a 10 minute long file - even if the limit was 3 minutes......
    What happens when you tell it to stop rather than
    relying on the time limit?
    x
    Do your part in supporting your fellow users. If a
    response has been Helpful to you or
    Solved your question, please mark it as such
    as an aid to other lost souls on the forum.
    Also, don't forget to mark the thread Answered
    when you get enough information to close the thread.

  • When I open a new window, the spinner does not stop, or the window open

    I have a MBP 3 yrs. old, running Snow Lep. When I open a new window, the spinner in the address bar spins and window does not open unless I click on the X and stop the spinner. Some times this doesn't work either. It just hangs up trying to open the next window.

    The given are very little details about your problem so please elaborate. 
    2. on each page load you have to verify whether the session variable. if "IsLoggedIn" exists and its value is "true" then you can show the requested page otherwise redirect to login page.
    if(Session["IsLoggedIn"] == null || Session["IsLoggedIn"] != "true")
    Response.Redirect("login.aspx");
    Better way: use a master page. In the load_page event, check the session. Thus, you wouldn't need to write the method to check in every page, just in the master page.
    Noam B.
    Do not Forget to Vote as Answer/Helpful, please. It encourages us to help you...
    Masterpage is a better idea.
    But The login page shouldn't use MasterPage OR need to have logic to check before redirecting to login page if you are already in Login page.
    Otherwise you will get into Recursive Redirection error.
    hope this helps.

  • The wifi does not work after update 5.1.1

    After I upgraded my Iphone 4 to IOS 5.1, the problem had wifi to connect to the wifi network is always seeking and never shows any network, my husband and I can connect does not mean it's my phone, he has not done the update.

    Thank you very much!! There are solutions for complex problems in this world because of persons like you!!

  • The cellphone does not start after error during th...

    Hello everyone,
    I started the software update on my N73 and received a message saying that the application (Nokia Software Update) was not working anymore and was forcing to shut down. The problem is that afterwards the cell phone cannot be started and after reading the help doc for the NSU, I tried to turn the connection between the laptop and the cell phone (I was doing this by cable) and now the device is not recognise, ergo I can't reconnect and restart the update or by that matter I can't do anything with the phone since it refuses to start.
    Does anyone have any idea about what I could do to make it at the very least start again?
    I'll hopefully wait for your suggestions, thank you in advance!
    Maria 
    Solved!
    Go to Solution.

    Dear post007. Thank you for pointing out that my posts are a waste of time. I'm sure everyone here will believe someone who has submitted under 20 posts over someone who has authored over 6000 and who has the second highest rank possible on this forum.
    It just so happens that the procedure I linked to does work for some people. As such there was also a chance that it could have worked for this person too and that pointing it out was therefore not pointless.
    Now, I'm not a moderator here, nor am I anything to do with Nokia other than being a happy user of many Nokia products over the years. However, I can confidently say that many here will frown upon a newcomer pointing out that information that has helped people in the past is a waste of time.
    Was this post helpful? If so, please click on the white "Kudos!" star below. Thank you!

  • The printer does not stop printing

    I have set up my printer (HP Color LaserJet CP1215) to my airport extreme; I have succeed to print to my printer. But the printer keep printing the same pages, and it prints continuously. Anybody know why this can be happened?

    Hello hhartono. Welcome to the Apple Discussions!
    I assume that you have this printer connected to the USB port on the AirPort Extreme Base Station (AEBS) ... correct? If so, does the AirPort Utility recognize it as the exact printer model?
    Unfortunately, not all USB printers are compatible with AirPort base stations. In addition, the AirPort's USB port does not support the "advanced" printer functions, like scanning, copying or faxing, of multi-function printers.
    To see if your printer is compatible, take a look at this iFelix Unofficial AirPort Printer Compatibility link.
    If your printer isn't listed, it doesn't necessarily mean it won't work, but simply that it has not been verified. iFelix also provides the following workaround for printers not on the list that would certainly be worth a try.
    Also you can try this Apple Tech Support article to see if it will help:
    o Printer troubleshooting for AirPort Base Stations and Time Capsule
    Finally, check out this IBM support article to see if the printer you are interested in is listed as having a Postscript or PCL3 interface. If it does, then it will most likely work with the AirPort's USB port. Printers that use the "HP LIDIL" interface must be connected to a computer directly and will not work.

Maybe you are looking for

  • How do to set up time limits on a guest network

    I have a new generation Airport Time Capsule and I have set up a Guest Network for my kids but I would like to set up time limits on the Guest Network also, is there a way to do it?

  • How do I find out what kind of computer I have?

    I am looking at the stickers on the bottom of my laptop and all I see is 8922 as the model number. When searching the website I could not find anything with 8922 in it.  I need help please.  I deleted my sound driver and I need a new one, but I can't

  • Acrobat 10.3.1 Crash while Printing

    To whom it may concern: At present, I am running Adobe Acrobat 10.1.3 and Reader 10.1.3 on Mac OS X Lion 10.7.4. Every time I attempt to print on either program, the application crashes and delivers the following message. What should I do? Process:  

  • Problem In Displaying records in table

    Hi, I have created a table and set the records displayed property as 10.But in controller I am dynamically inserting one row in the table at index 0. So whenever the vo returns morethan 10 rows ,the table displays last record first.Suppose the vo ret

  • Customization of Advanced Search Area

    Hi All,           There is a requirement in advanced search area of return orders.           Based on the transaction type selected, corresponding status values has to be populated.          Here im populating the transactio type values in the drop d