Java? Stopping after criteria has been met?

Hi, I have this piece of code I have written;
num2 = Integer.parseInt(JOptionPane.showInputDialog("Enter second number"));
if (num1<0){
negative = ("You have entered a negative number!");
JOptionPane.showMessageDialog (null, negative);
num3 = Integer.parseInt(JOptionPane.showInputDialog("Enter third number"));
if (num1<0){
negative = ("You have entered a negative number!");
JOptionPane.showMessageDialog (null, negative);
if ((num1 == num2) && (num1 == num3))
result = ("Your triangle is equalateral, all sides are the same length!");
JOptionPane.showMessageDialog (null, result);
Everytime the user enters a negative number a message pops up saying "You have entered a negative number" BUT then it goes onto the second string and then third string.
I have 3 strings, e.g.
String 1 -> User enters 10
String 2 -> User enters -19 = You have entered a negative number
String 3 -> User enters 99
How can I get the program to stop after the "You have entered a negative number message? Thanx.

Hi,
How can I get the program to stop after the "You have entered a negative number message?{code}
If you want to terminate the currently running jvm use
{code}
System.exit(0);
{code}
Thanks                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • 3 year old iMac 24 running OS10.7.4.  After it has been on for a day or so, it stops going to sleep and becomes very slow.  This only happens when Safari is running. Quitting Safari solves the problem.  Has anyone else have the same problem?

    3 year old iMac 24 running OS 10.7.4.  After it has been on for a day or so, it stops going to sleep and becomes very slow.  This only happens when Safari is running. Quitting Safari solves the problem.  Has anyone else have the same problem?  Does not happen on MacBookpro only on iMac.

    Hello Albert, see how many of these you can answer...
    See if the Disk is issuing any S.M.A.R.T errors in Disk Utility...
    http://support.apple.com/kb/PH7029
    Open Activity Monitor in Applications>Utilities, select All Processes & sort on CPU%, any indications there?
    How much RAM & free space do you have also, click on the Memory & Disk Usage Tabs.
    Open Console in Utilities & see if there are any clues or repeating messages when this happens.
    In the Memory tab, are there a lot of Pageouts?

  • How do i get back my stateful session bean after it has been passivated

    hi ,
    How do i get back my stateful session bean after it has been passivated by container.
    i'm confused that is it possible or not .......give me answer
    i've one stateful sessionbean which i'm accessing throgh my normal java client . now what i'm doing is when i first time call a method it is running ......then i'm shutting down the server jboss .......it is calling my ejbPassivate() method ... at this particular time client program doesn't do anything.....
    now after i restart my server i'm again calling back that business method with that last object reference.......it gives me the exception given below.....
    java.rmi.NoSuchObjectException: no such object in table
    java.rmi.NoSuchObjectException: no such object in table
         at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
         at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
         at sun.rmi.server.UnicastRef.invoke(Unknown Source)
         at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
         at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:118)
         at org.jboss.invocation.InvokerInterceptor.invokeInvoker(InvokerInterceptor.java:227)
         at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:167)
         at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:46)
         at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:55)
         at org.jboss.proxy.ejb.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java:106)
         at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86)
         at $Proxy1.makeNewAcc(Unknown Source)
         at client.GanJavaClient.main(GanJavaClient.java:46)so pls tell me that is it possible to get back that session besn or not

    Stateful session beans are not persisted across restart of the EJB server instance(s) hosting them. You can't treat a Session bean as one would an entity bean.
    Chuck

  • After Firefox has been running a while, every link opens a new window

    After Firefox has been running for a while, every link starts opening in a new window. Until today, if I closed Firefox and restarted it, it would stop happening ... until it started happening again. Then today, I closed it down and restarted it, and it was STILL happening. So either I find a solution, or I stop using Firefox on my Mac.
    This is a vanilla installation - both for the Mac and Firefox. I don't use the Mac as my main computer. The Mac is running OS X 10.5 8. The problem has existed through many upgrades of Firefox. I always upgrade as requested. This last time, however may have been the killer. A new upgrade was installed right before the problem became unfixable by shutting down and restarting. I'm running Firefox 15.0. I just rebooted, however, and now (for now), it's working properly.
    I have no add-ons installed in Firefox.
    My only plug-ins are iPhotoPhotocast, QuickTime, SharePoint, and Shockwave Flash.
    I've seen multiple reports of this problem on this Web site, but no solutions. Just a generic recommendation to disable add-ons to see which one is conflicting. But I'm running no add-ons. I think there's a bug in Firefox.

    If it were an extension or theme or a Mac driver, wouldn't it cause the problem consistently? This only happens after Firefox has been running for a while. I'm using Firefox to type this reply right now, and the problem is not happening.
    And it's not because I suddenly start using some offending software. As I said, I don't use the Mac as my main computer. Usually I'll have been using my PC, I'll go back to the Mac to check my email on Firefox, and suddenly the link problem is happening. I only use the Mac to check email on the server before I download it with Outlook (on the PC) so I can delete spam on the server first.

  • Tiles- Cannot forward after response has been committed Error

    I am trying to use following approach for my tiles implementation but i am getting error like
    java.lang.IllegalStateException: Cannot forward after response has been committed.
    I have gone thorugh the other posts regarding the same error but not helping me.
    Any clues greatly appreciated.
    Thanks,
    Sachin
    "I haven't found a way to directly dispatch to a tiles definition, but you can eliminate the need for multiple "wrapper" JSPs by creating a single "tilesDispatch" JSP that is able to dispatch to different tiles definitions, and establishing a convention for mapping URLs to that JSP, and identifying the tiles definition you want to load.
    For example, you could use the following convention to identify a tiles definition:
    /tiles/defName
    where "defName" is the name of the tiles definition (from tiles.xml) that you want to use. The code for the tilesDispatch.jsp would be as follows:
    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ taglib prefix="t" uri="http://jakarta.apache.org/struts/tags-tiles" %>
    <%
    String tilePath = request.getRequestURI();
    int slashIndex = tilePath.lastIndexOf('/');
    if (slashIndex >= 0) {
    tilePath = tilePath.substring(slashIndex+1);
    %>
    <t:insert definition="<%=tilePath%>" flush="false"/>
    The scriptlet code takes the request URL (e.g. /tiles/defName), strips off everything up to and including the final slash (e.g. defName), then the tiles "t:insert" tag is used to look up and insert the corresponding tiles definition.
    In order to map all URLs of the form /tiles/* to the tilesDispatch.jsp, you would need to add the following to your web.xml:
    <servlet>
    <servlet-name>tilesDispatch</servlet-name>
    <jsp-file>tilesDispatch.jsp</jsp-file>
    </servlet>
    <servlet-mapping>
    <servlet-name>tilesDispatch</servlet-name>
    <url-pattern>/tiles/*</url-pattern>
    </servlet-mapping>
    Note: You may need to insert a slash before tilesDispatch.jsp in the <jsp-file> element. I am using pre-compiled JSPs, so my configuration is a little different. So if <jsp-file>tilesDispatch.jsp</jsp-file> doesn't work, try <jsp-file>/tilesDispatch.jsp</jsp-file>.
    Once you have this set up, you can refer to tiles definitions using the /tiles/defName convention in your faces-config.xml. For example, if you have two tiles definitions in your tiles.xml file: tile1 and tile2, you could have something like the following in faces-config.xml:
    <navigation-rule>
    <from-view-id>/tiles/tile1</from-view-id>
    <navigation-case>
    <from-outcome>success</from-outcome>
    <to-view-id>/tiles/tile2</to-view-id>
    </navigation-case>
    </navigation-rule>
    Note that when I have used this convention, I also have used the prefix mapping for JSF. That is, when linking to a JSF page, based on a tiles definition, from a non-JSF page, the URL would be as follows:
    /faces/tiles/defName
    In this case, the Faces servlet is initially invoked, which sets up the JSF environment. Then the /faces prefix is stripped off, and the remaining URL (/tiles/defName) is routed to the tilesDispatch.jsp, which strips off the /tiles/ prefix, and inserts the "defName" definition.
    We are currently using this approach in a number of web apps, and it is working very reliably. I hope this helps.

    Hi gimbal2,
    I hope to better explain.
    In my JSF code I have the next:
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:fn="http://java.sun.com/jsp/jstl/functions">
         <h:body>
              <ui:composition template="/template.xhtml">
                   <ui:define name="page">
                        <h:head>
                             <h:outputStylesheet ...
                        </h:head>
                        <h:form id="form1">
                             <rich:dataTable      id="table"
                                            value="#{listBeanRequest.elements}"
                                            var="element">
         </h:body>
    </html>
    In the listBeanRequest class, the method getElements() has a line, Integer h = Integer.valueOf("a");, which efforts the java.lang.NumberFormatException
    An in my web.xml I have:
    <filter>
         <filter-name>SecurityFilter</filter-name>
         <filter-class>my.filter.SecurityFilter</filter-class>
    </filter>
    I'm using JSF 1.2 running on Apache Tomcat 6

  • How to forbid any further changes for PO (QTY and price ) after it has been

    Hi,
    How to forbid any further changes for PO (QTY and price ) after it has been done GR and LIV? Thanks.

    Hi,
    Price anyway cannot be changed once GR is posted on the PO item, it can be changed only by cancelling the GR, the same applies to IR too.
    But quantity can be changed at any time.
    So if you are looking at blocking qty too, then a customized message through save exit is the option, I am not aware of any standard SAP messages that can be configured to achieve this..
    Ramesh

  • Set Cursor.vi fails after it has been called for 30 different panel refs in LV 7.1.1

    Make sure both attached files (Run LabVIEW_Cursor_TestCase.vi, SimpleVI.vi) are in the same folder. Run LabVIEW_Cursor_TestCase.vi notice that the -3 error code is returned from "Set Cursor.vi" after it has been called with 30 different panel refs. If "Set Cursor.vi" is replaced with "Set Busy.vi" the same error occurs.Is there a workaround for this problem other that setting the cursor image manually in user32.dll? I must be able to open more than 30 panels and set them all to busy. In the test case I used a single VI, simply to demonstrate the error.
    Message Edited by Jerred on 05-04-2007 10:06 AM
    Attachments:
    LabVIEW_Cursor_TestCase.vi ‏68 KB
    SimpleVI.vi ‏13 KB

    This bug is fixed in LabVIEW 8.0 and later.  Unfortunately, I know of no workaround in LabVIEW 7.x.  When I encountered this bug in one of my UIs in LabVIEW 7.x, my "fix" was simply to ignore the error outputs from the cursor VIs, and to live with the fact that I had no custom cursors after 30 windows had been opened.
    -D
    Darren Nattinger, CLA
    LabVIEW Artisan and Nugget Penman

  • Can't download music from PC to IPhone 5. Error message says "Cannot copy item. The device has either stopped responding or has been disconected. Help?

    Can't download music from PC to IPhone 5. Error message says "Cannot copy item. The device has either stopped responding or has been disconected. But the phone is connected. Help!!

    Hello iyurdin,
    We've an article that can help keep your iPhone connected in Windows' eyes.
    iOS: Troubleshooting USB connection
    http://support.apple.com/kb/TS1286
    Cheers,
    Allen

  • How to settle the expenses after AUC has been capitalised.

    Hi All,
    I have a understanding that after AUC has been settled, we can edit the settlement rule in WBS element and settle directly to the capitalised assets.
    I can not see the settlement rule but investment profile since the project being a Capital comes from Investment measure and automatically created.
    Can you tell me how to create a new settlement rule in this case. It is Urgent
    Regards
    VK

    Hi Vijay,
    This requires a change in the settlement rule since the AUC is no more and it must be the settlement reveiver earlier which should be changed to the main asset after capitalisation.
    Please go to Transaction code CJ20N, select the WBS and go to settlement rule via edit > Cost and set the receiver as the fixed assets itself instead of AUCV since AUC has been transferred to main assets.
    You can then settle using CJ8G or CJ88 but CJ88 is a better option.
    I think, I have answered the same query.
    Regards
    Bharat

  • Workflow Shows as 'In Progress' after Workflow has been completed.

    Hello All,
    I have created a custom workflow using SharePoint Designer. Within this workflow I have multiple 'approval process' tasks. In theory this was so that once the first user had approved the item then the next would be prompted to approve the item, and
    so on. The users that the item must be approved by are set when the item is submitted initially.
    Just so anyone reading this knows I have no formal experience/education in SharePoint workflow design, but I would like to think I know my way around SharePoint(in general) at this point.
    My problem is, the company I work for is just starting out using SharePoint workflows, and from what I understand workflows that are 'In Progress' are related to server performance. I noticed today that there are 5 items in the list which
    under the 'workflow status' column display that they are 'In Progress' which is entirely correct. However, when I go to -> 'List Settings' -> 'Workflow Settings' this workflow is showing 8 workflows 'In Progress'.
    Thank you to anyone who is able to help me with this,
    James

    Hi,
    According to your post, my understanding is that workflow shows as 'In Progress' after Workflow has been completed.
    To send the task one by one, you can select one at a time(serial) when you select Task Process Participants.
    Per my knowleadge, when you go to -> 'List Settings' -> 'Workflow Settings', it show all the workflows you associated to the list.
    To see the running workflow, you need to select an item, right click the title, and then select the workflow.
    However, each workflow enstance can only start once on an item.  In other word, you can not start the same workflow again untill the previous one is completed.
    As you said, workflow shows as 'In Progress'.
    Please make sure all the users have approved the tasks.
    Best Regards,
    Linda Li
    Linda Li
    TechNet Community Support

  • How to enable my Ipad after it has been dissable by too many wrong attempts to enter passcode?

    How to enable my Ipad after it has been dissable by too many wrong attempts to enter passcode?

    You have to restore the iPad in order to unlock it using these instructions.
    http://support.apple.com/kb/HT1212?viewlocale=en_US&locale=en_US

  • HT1212 how to enable my iphone after it has been disenabled?

    How to enable my iphone after it has been disabled?

    You have to restore the iPad in order to unlock it using these instructions.
    http://support.apple.com/kb/HT1212?viewlocale=en_US&locale=en_US

  • SQLException: After clearParameters() has been called, all parameters must be reset before executing

    Hi,
    I am running: Weblogic 6.1, SP2
    Driver : weblogic.jdbc.oci.Driver
    Reason for not using the "thin" driver, which works, is limit
    on size of Clob
    Previous references to this problem in this newsgroup indicate driver problems
    with older versions of WL.. I am using the latest..
    The SQLException I get is "After clearParameters() has been called, all parameters
    must be reset before executing". This happens the second time the code below is
    excuted ( ok the first time )
    "clearParameters()" is never called explicitly in my code.
    The exception occurs on the "spFunc.execute();" statement at the very end of this
    code:
    // OBS:connection, conn_, is opened from a connection pool
    before this code is called and cloesed afterwards.
    conn_.setAutoCommit(false);
    // ============== Initializing clob ==================
    SerialStatement stmt = (SerialStatement)conn_.createStatement();
    stmt.execute("INSERT INTO lc_clob_temp VALUES (1, EMPTY_CLOB())");
    // OBS: using a prepared statement here will result in SerialClob
    // exception when using setClob in the prepared statement
    below
    // This is probably a bug ( worked in WL 5.1 ). We had this
    as a support case 270952 with WebLogic.
    stmt.execute("SELECT * FROM lc_clob_temp WHERE id = 1");
    ResultSet crs = stmt.getResultSet();
    weblogic.jdbc.rmi.SerialClob xmlClob = null;
    while ( crs.next() ) {
    xmlClob=(weblogic.jdbc.rmi.SerialClob)crs.getClob("newclob");
    // Call Oracle's stored procedure for calling Oracle XSU.
    SerialCallableStatement spFunc =
    (SerialCallableStatement)conn_.prepareCall(
    "declare " +
    "insCtx sys.DBMS_XMLSave.ctxType; " +
    "begin " +
    "insCtx := sys.DBMS_XMLSave.newContext(?); " +
         "sys.DBMS_XMLSave.setBatchSize(insCtx,0);" +      "sys.DBMS_XMLSave.setCommitBatch(insCtx,
    0);" +
    "? := sys.DBMS_XMLSave.insertXML(insCtx,?); " +
    "sys.DBMS_XMLSave.closeContext(insCtx); " +
    "end;"
    spFunc.setString(1, viewName );
    spFunc.registerOutParameter (2, Types.NUMERIC);
    Writer outstream = xmlClob.getCharacterOutputStream();
    outstream.write(xml.toString());
    outstream.flush();
    outstream.close();
    spFunc.setClob( 3, xmlClob);
    spFunc.execute();
    spFunc.close();

    Hi,
    I am running: Weblogic 6.1, SP2
    Driver : weblogic.jdbc.oci.Driver
    Reason for not using the "thin" driver, which works, is limit
    on size of Clob
    Previous references to this problem in this newsgroup indicate driver problems
    with older versions of WL.. I am using the latest..
    The SQLException I get is "After clearParameters() has been called, all parameters
    must be reset before executing". This happens the second time the code below is
    excuted ( ok the first time )
    "clearParameters()" is never called explicitly in my code.
    The exception occurs on the "spFunc.execute();" statement at the very end of this
    code:
    // OBS:connection, conn_, is opened from a connection pool
    before this code is called and cloesed afterwards.
    conn_.setAutoCommit(false);
    // ============== Initializing clob ==================
    SerialStatement stmt = (SerialStatement)conn_.createStatement();
    stmt.execute("INSERT INTO lc_clob_temp VALUES (1, EMPTY_CLOB())");
    // OBS: using a prepared statement here will result in SerialClob
    // exception when using setClob in the prepared statement
    below
    // This is probably a bug ( worked in WL 5.1 ). We had this
    as a support case 270952 with WebLogic.
    stmt.execute("SELECT * FROM lc_clob_temp WHERE id = 1");
    ResultSet crs = stmt.getResultSet();
    weblogic.jdbc.rmi.SerialClob xmlClob = null;
    while ( crs.next() ) {
    xmlClob=(weblogic.jdbc.rmi.SerialClob)crs.getClob("newclob");
    // Call Oracle's stored procedure for calling Oracle XSU.
    SerialCallableStatement spFunc =
    (SerialCallableStatement)conn_.prepareCall(
    "declare " +
    "insCtx sys.DBMS_XMLSave.ctxType; " +
    "begin " +
    "insCtx := sys.DBMS_XMLSave.newContext(?); " +
         "sys.DBMS_XMLSave.setBatchSize(insCtx,0);" +      "sys.DBMS_XMLSave.setCommitBatch(insCtx,
    0);" +
    "? := sys.DBMS_XMLSave.insertXML(insCtx,?); " +
    "sys.DBMS_XMLSave.closeContext(insCtx); " +
    "end;"
    spFunc.setString(1, viewName );
    spFunc.registerOutParameter (2, Types.NUMERIC);
    Writer outstream = xmlClob.getCharacterOutputStream();
    outstream.write(xml.toString());
    outstream.flush();
    outstream.close();
    spFunc.setClob( 3, xmlClob);
    spFunc.execute();
    spFunc.close();

  • My computer does not eject the disc after it has been burned.

    I understand that my computer is supposed to automatically eject a disc after it has been burned. Mine doesn't. Instead, I hear a "Plonk," which I assume is announcing that the burning process has been completed.
    First of all, is it true that the disc is supposed to be ejected after the burn has been completed? Secondly, how can I restore that function?

    Diane Wordsmith wrote:
    To clarify...are you importing songs from a CD into iTunes, or are you burning songs from iTunes onto a blank CD? If it's the former, iTunes won't eject it...you'll just hear a chime or noise when it's done. If it's the latter it should eject.
    For the second poster, it sounds you are importing. In which case, you will just hear the sound when importing is finished and you eject the CD yourself.
    Just to make sure that I understand you correctly, here's what I did: Imported songs from website. They were in RealPlayer format. I then converted the song files into MP3 format, and put them into my iTunes music library. Finally, I put the songs in a New Smart Playlist, and burned them into a blank disc.
    Given this situation, should I expect the disc to automatically eject when the burning is competed? If so, what do I have to do to get it to work properly?

  • Removing a speed dial after it has been setup

    How do I remove a speed dial after it has been set ?

    Open speed dial page and click the - icon to right of number.
    + +

Maybe you are looking for