Query about break statement in java

Hi All,
I am looking at some seeded oracle class and came across this code and wanted to understand what it does in the catch exception part ( in bold below).
Thanks
Shanky
protected String getOrgIdFromTransaction(OAPageContext oapagecontext, String s, String s1)
    String s2;
    String s3;
    StringBuffer stringbuffer;
    ViewObject viewobject;
    s2 = "-1";
    s3 = null;
    stringbuffer = (new StringBuffer(" select org_id")).append(" from ar_payment_schedules");
    if (s != null)
      stringbuffer.append(" where payment_schedule_id = :1");
      s3 = s;
    } else
    if (s1 != null)
      stringbuffer.append(" where customer_trx_id = :1");
      s3 = s1;
    viewobject = null;
    try
      viewobject = oapagecontext.getRootApplicationModule().createViewObjectFromQueryStmt("CustSiteForInvoiceVO", stringbuffer.toString());
      viewobject.setWhereClauseParam(0, s3);
      Object obj = null;
      viewobject.executeQuery();
      while (viewobject.hasNext())
        Row row = viewobject.next();
        s2 = row.getAttribute(0).toString();
      viewobject.remove();
    catch (Exception exception)
      throw OAException.wrapperException(exception);
    * viewobject.remove();  // when does this part and below get executed ? *
    *break MISSING_BLOCK_LABEL_176 ; // where is this label ? *
    *Exception exception1;*  // define a variable of type Exception
    *exception1;  // what does this do ? *
    viewobject.remove();
    *throw exception1;*  // why throw this ?
    return s2;
  }

Thanks Shekhar.
I have read that and understand the break statement. But I cannot see a label mentioned in my code sample.
Where is that label ? Oracle have used this in many places.
Any ideas ?

Similar Messages

  • INSERT statement in Java and MS Access

    Hi all,
    can anyone please tell me how to insert data to an MS Access table using JSP i tried INSERT statement of java but it is getting errors saying INSERT statement is wrong. I have no idea about MS access insert statement. i am totally tired of this. Please someone help me.

    Hello,
    MS Sql can cause problems where it goes off standard, however I dont think insert is any different.
    INSERT INTO table_name (column1, column2) VALUES (variable1, variable2)
    Make sure your table and column names are exactly right, Java is case sensitive, so make sure the case is correct also.
    The other common error is if you have a required field in the database that is not populated by your program, so, if for instance there was a column3 in the table for the above example, which was a required field, the sql would fail as there is no data being entered for column3.

  • Need help with a For loop that uses a Break statement

    I need to create a for loop which counts down from 100-50 and divides the number being counted down by a counter. Can anyone help me?
    public class Break
    public static void main ( String args []) (;
         int total = 0
         int counter = 0
         for { (int number = 100; total >=50; total --)
         if (counter == 0)
         break;
         } // end of for loop
         int output = number/counter
         system.out.printf("The number is" %d output/n)
         }// end of method main
    }// end of class Break

    Im sorry I didnt explain myself very well i do not need the break statement at all.
    I now have this code:
    public class BreakTest
       public static void main( String args[] )
          int count; // control variable also used after loop terminates
         for (int i = 100; i >= 50; i = ++count)
       if (i >= 50) {
        continue;
          System.out.printf( "\nBroke out of loop at count = %d\n", count );
       } // end main
    } // end class BreakTest
    /code]
    and i get these error messages:
    F:\csc148>javac BreakTest.java
    BreakTest.java:9: variable count might not have been initialized
         for (int i = 100; i >= 50; i = ++count)
                                          ^
    BreakTest.java:15: variable count might not have been initialized
          System.out.printf( "\nBroke out of loop at count = %d\n", count );
                                                                    ^
    2 errors                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Question about delete statement

    I have question about delete statement...
    i am performing some simple delete statement against one table..but its taking so long..How can we check whether particular delete statements actually deleting records or not..?

    Is the associated select-statement returning rows or not?
    If yes -> delete is deleting
    If no -> delete is just using CPU-cycles
    To tune the delete-statement, you have to tune the corresponding select-statement. To tune the select-statement, you want to read the thread When your query takes too long ...

  • Query about local storage

    Hi,
         i had a query about local storage.
         I've a machine that hosts weblogic and tangosol. i've an ejb that accesses a distributed cache i.e NamedCache cache = CacheFactory.get("MyCache")
         i modified tangosol-coherence.xml and set local-storage to false ( for distributed cache) and replaced the file in coherence.jar.
         i'm using an overflow scheme and the back map uses a disk scheme.
         i also start a separate standalone instance of tangosol and i set the system property of local storage to true for the standalone instance.
         i start the standalone instance first and then weblogic.
         The idea is ensure that the tangosol instance in weblogic or the weblogic JVM should not participate in storing data (hence local storage false).
         only the JVM for the standalone instance should store data (hence local storage true -system property).
         i wanted to know whether the property "local-storage" is pertinent to a member(machine) or to a JVM?
         the reason for this doubt: as i'm using a disk scheme, tangosol creates a file for an overflow (e.g lh014402~.tp). i can see two such files when ideally i would have wanted only one for the tangosol instance.
         -rw-r--r-- 1 zephyr users 8364032 2005-06-23 17:02 lh014402~.tp
         -rw-r--r-- 1 zephyr users 8364032 2005-06-23 17:02 lh014403~.tp.
         can you please let me know if we can configure tangosol in such a way that we can two separate instances running with local stroage false for one and true for the other?
         Awaiting your reply
         Thanks
         Vinay

    I would suggest leaving the default 'local-storage' value set to 'true' in the tangosol-coherence.xml and just use the JVM argument to control the local storage of each individual node. Then start the stand alone instance normally (I assume you are using the com.tangosol.net.DefaultCacheServer) and start the WebLogic instance with the following:
         java [...] -Dtangosol.coherence.distributed.localstorage=false [...]
         Hope this helps.
         Later,
         Rob Misek
         Tangosol, Inc.

  • Can any  one explain me about break point

    Hi gurus
    What is break point what is the use of it? please let me know what is the use of it?
    Thanks in advance

    Hi
    Hi,
    A breakpoint is a signal at a particular point in the program that tells the ABAP runtime processor to interrupt processing and start the Debugger. The Debugger is activated when the program reaches this point.Max 30 breakpoints we can use.
    Session Breakpoints exist only until you are logged in or until ur session is active. Even if u forget to remove the session break points, they are automatically removed once ur session becomes invalid or u logged out.
    Debugger
    This section of the ABAP Workbench documentation provides information on how to use the Debugger as a test tool for finding errors in the source code of an ABAP program.
    Functional Overview
    Use
    The ABAP Debugger is an integrated test tool within the ABAP Workbench. You use it to check the program logic and to find errors in the source code of an ABAP program. In the Debugger, you can step through the source code of a program. The running program is interrupted after each step, allowing you to check its processing logic and the results of individual statements.
    As of Release 6.10, you can also run Business Server Pages (BSP) in the debugging mode. You can also display and set breakpoints here. Business Server Pages can be displayed in the Object Navigator when you select an appropriate application under BSP Application.
    Features
    The Debugger provides an efficient means of identifying errors in ABAP programs. It contains the following functions:
    Ways of starting the Debugger
    Choosing different views
    Choosing different execution options in the Debugger
    Displaying source code in the Debugger
    • Setting and deleting breakpoints
    • Setting and deleting watchpoints
    • Stopping a program at a particular statement or event
    Displaying and changing field contents at runtime
    Displaying ABAP Objects and references
    Displaying and positioning strings
    Setting and deleting database locks
    Opening the ABAP Editor, or Object Navigator
    System settings and runtime warnings
    Starting the Debugger
    There are two possible strategies for starting the Debugger in the ABAP Workbench:
    By setting breakpoints then running the program
    By running the program in debugging mode.
    Setting Breakpoints
    A breakpoint is a signal in a specific line of the program source code. This signal indicates to the ABAP runtime processor to stop the program at the relevant line and start the ABAP Debugger. A distinction is made between static and dynamic breakpoints. For further information about the different types of breakpoints and how to use them, refer to Breakpoints.
    Direct Processing
    You can start the Debugger without previously having set breakpoints. This is the best procedure to use when you want to test a program right from the beginning. It is also a useful procedure if you are not overly familiar with the program and therefore are not sure where best to set breakpoints. You can start the Debugger as follows:
    From the Object Navigator
    Select a report or transaction and choose Program ® Test ® Debugging.
    From the ABAP Editor
    Choose Program ® Execute ® Debugging (or the Debugging pushbutton).
    From any screen
    Choose System ® Utilities ® Debug ABAP.
    From any screen
    Enter /h in the command field.
    Display Modes in the Debugger
    When you are debugging a program, there are various display modes that you can use. All of the display modes have the same structure. The top part of the screen displays an extract of the program source code. The bottom part displays the information specifically available in that display mode. There are also pushbuttons on the screen allowing you to switch to the most frequently-used display modes.
    Display Modes Available Using Pushbuttons
    Fields
    The scrollable field display contains the contents of up to eight fields. The contents of the three most important system fields are always displayed. This is the default display mode in the Debugger. See also Processing Fields
    Table
    Displays the contents of an internal table. This mode allows you to display and edit the entries in an internal table. See also Processing Internal Tables
    Breakpoints
    A scrollable display containing up to 30 breakpoints. Next to each breakpoint is a counter. You can also delete breakpoints in this display. See also Managing Dynamic Breakpoints
    Watchpoints
    You can set a watchpoint for a field so that the program is interrupted whenever the value of that field changes. This display mode contains a list of watchpoints, the fields and programs to which they are assigned, the current values of the fields, and the conditions upon which the watchpoint is activated. See also Setting Watchpoints
    Calls
    This mode displays the current sequence of events, and the sequence of calls up to the current breakpoint. The last active call is displayed at the top of the list; previous calls are listed in reverse chronological order. When an event (for example, START-OF-SELECTION) concludes, it is deleted from the display.
    Overview
    This mode displays the structure of the program. It lists its events, subroutines, and modules, and shows which sections belong to which events. It also displays the section currently being processed.
    Settings
    This mode displays the current Debugger settings. You can change the settings by selecting or deselecting various options. For further information, refer to Settings and Warnings
    Other Display Modes
    You can access other display modes by choosing Goto ® Display data object.
    Single field
    Displays the contents and technical attributes of a field.
    Structured
    field
    Displays the components of a structure, along with their contents and attributes. If you double-click a component, the system displays detailed information for it.
    Strings
    Display the content and current length of the string. You can also display part of the content by means of offset and length.
    Internal table
    Displays the type, line numbers and contents of an internal table.
    Object
    Displays the structure of an ABAP Object.
    For further information on these displays, refer to Displaying Attributes and Displaying ABAP Objects
    Checking System Programs for Errors
    To check a program or program component that is part of the ABAP Workbench (for example, the Screen Painter), you must use the system Debugger. To start the system Debugger, choose System ® Utilities ® Debug System from any screen. To stop the system Debugger, choose Debugger ® Debugging off.
    Displaying Program Attributes
    You can display the attributes Fixed Point Arithmetic, System Program, and Unicode Checks of the program that has just been executed by choosing Goto ® Further Information ® Program Attributes.
    Restarting the Debugger
    If you choose Debugging ® Restart, debugging mode is stopped and the system takes you to the initial screen of the last transaction you called. If, for example, you started an ABAP program in debugging mode from transaction SE38 (ABAP Editor), choosing Debugging ® Restart will take you back to the screen titled ABAP Editor: Initial Screen. If you want to restart the program in debugging mode, choose Debugging.
    Breakpoints
    Apart from direct execution of an ABAP program in the Debugger, it is also possible to start the Debugger call by the exact setting of a breakpoint. This is achieved by setting one or more of these breakpoints in the program. A breakpoint is a signal at a particular point in the program that tells the ABAP runtime processor to interrupt processing and start the Debugger. The program runs normally until the breakpoint is reached.
    There is also a special kind of breakpoint called a watchpoint. When you use watchpoints, the Debugger is not activated until the contents of a particular field change. For further information, refer to Watchpoints.
    Breakpoint Variants
    The Debugger contains different breakpoint variants:
    Static
    The BREAK-POINT statement in an ABAP program. Static breakpoints are not normally user-specific. However, you can make them user-specific.
    Directly-set
    dynamic breakpoints
    Can be set in the ABAP Editor or the Debugger. Dynamic breakpoints are always user-specific, and are deleted when you log off from the R/3 System.
    Breakpoints
    at statement
    The Debugger stops the program directly before the specified statement is executed.
    Breakpoints
    at subroutine
    The Debugger stops the program directly before the specified subroutine is called.
    Breakpoint at function module
    The Debugger stops the program directly before the specified function module is called.
    Breakpoint at method
    The Debugger stops the program directly before the specified method is called.
    Breakpoints at system exceptions
    The Debugger stops the program directly after a system exception, that is, after a runtime error has been intercepted.
    Static Breakpoints
    Static breakpoints are not normally user-specific. Once a user has inserted the statement BREAK-POINT or BREAK name in an ABAP program, the system always interrupts the program at that point for that user or only for the user name. This procedure is only useful in the development phase of an application, when the program execution is always to be interrupted at the same place. For further information, refer to Static Breakpoints.
    In HTTP sessions, a static breakpoint is skipped if you did not set additional dynamic HTTP breakpoints in the editor of a BSP page. Instead, a corresponding system log entry is written, which can be checked using transaction SM21.
    Dynamic Breakpoints
    Dynamic breakpoints are user-specific. Therefore, you should use them if you only want the program to be interrupted when you run it yourself, not when it is being executed by other users. All dynamic breakpoints are deleted when you log off from the R/3 System.
    Dynamic breakpoints are more flexible than static breakpoints, because you can deactivate or delete them at runtime. They have the following advantages:
    You do not have to change the program code
    You can set them even when the program is locked by another programmer
    You can define a counter that only activates the breakpoint after it has been reached
    Special dynamic breakpoints are useful when you want to interrupt a program directly before a particular ABAP statement, a subroutine, or an event, but do not know exactly where to find it in the source code. Event here is used to refer to the occurrence of a particular statement, for example, or calling up a method. Special dynamic breakpoints are user-specific. You can only set them in the Debugger. For further information, refer to Dynamic Breakpoints.
    In HTTP sessions, the system stops both at static and dynamic breakpoints if a dynamic breakpoint was set in the editor of a BSP page before program execution.
    Lifetime and Transfer of Breakpoints
    A static breakpoint remains intact as long as the BREAK-POINT or BREAK-POINT name statement is not removed from the source code. Without saving, dynamic breakpoints only remain intact in the relevant internal session. However, they are effective during the entire user session, if they are saved by choosing Breakpoints ® Save in the ABAP Debugger. For more details on the subject of sessions and user sessions, refer to Modularization Techniques in the ABAP keyword documentation.
    If you call an HTTP session during a user session, only the HTTP breakpoints are loaded when the HTTP session is started. You activate HTTP debugging in the ABAP Editor by choosing Utilities ® Settings ® HTTP Debugging. Depending on the setting, the system then displays either the HTTP or standard breakpoints in the Editor.
    If you call an update session during a user session, breakpoints that were defined beforehand in the calling processing unit are copied to the new update session, where they can be displayed under Breakpoints. If, in the ABAP Debugger, you check Update Debugging under Settings and then, for example, call the update module func using CALL FUNCTION func IN UPDATE TASK, a new window is opened in which you can debug this function module in the update session. All the breakpoints that were set in the calling processing unit can also be processed here.
    Breakpoints at Statements
    You can use this special kind of dynamic breakpoint to interrupt a program directly before an ABAP statement is processed.
    Prerequisites
    You must already be running the program in the Debugger.
    Procedure
    To set a breakpoint at an ABAP statement:
    1.Choose Breakpoint ® Breakpoint at ® Statement...
    The following dialog box appears:
    2.Enter the ABAP statement.
    The system sets a breakpoint at all points in the program at which the ABAP statement occurs.
    3.Choose ENTER.
    The breakpoint applies to all lines containing the specified statement.
    Result
    The system confirms the breakpoint and adds it to the list in the display. When you finish your debugging session, the breakpoint is automatically deleted unless you have explicitly saved it.
    Breakpoints at Subroutines
    You can use this special kind of dynamic breakpoint to interrupt a program directly before a subroutine is called.
    Prerequisites
    You must already be running the program in the Debugger.
    Procedure
    To set a breakpoint for a subroutine:
    Choose Breakpoint ® Breakpoint at ® Event/Subroutine.
    The following dialog box then appears:
    Enter the name of the subroutine before which you want to interrupt the program. By default, the Program field contains the name of the program that is currently active. The system sets a breakpoint wherever the specified subroutine occurs in the program code.
    Choose ENTER.
    Result
    The system confirms the breakpoint. The breakpoint is added to the breakpoints displayed.
    Breakpoints at Function Module
    You can use this kind of dynamic breakpoint to interrupt a program directly before a function module is called.
    Prerequisites
    You must already be running the program in the Debugger.
    Procedure
    To set a breakpoint for a function module:
    Choose Breakpoint ® Breakpoint at ® Function module...
    The following dialog box appears:
    Enter the name of the function module before which you want to interrupt the program. The system sets a breakpoint wherever the specified event, module pool, or subroutine occurs in the program code.
    Choose ENTER.
    Result
    If you entered a valid function module name, the system confirms that the breakpoint has been set. If the function module exists in the system, the new breakpoint is added to the display list.
    Breakpoints at Methods
    You can use this special kind of dynamic breakpoint to interrupt a program directly before a method is called.
    Prerequisites
    You must be already running the program in the debugger.
    Procedure
    To set a breakpoint for methods:
    1. Choose Breakpoint ® Breakpoint at ® Method...
    The following dialog box then appears:
    2. Enter the name of the method and class before which you want to interrupt the program. A breakpoint is then set each time the specified processing block appears in the source code.
    3. Choose ENTER.
    Result
    The system confirms the breakpoint. The breakpoint is added to the list in the display.
    Breakpoints at System Exceptions
    You can use this special form of dynamic breakpoint to interrupt a program immediately after a runtime error has occurred.
    Prerequisites
    You must already be running the program in the Debugger.
    Procedure
    To set a breakpoint at a system exception:
    Choose Breakpoint ® Breakpoint at ® System exception.
    Result
    The system confirms the breakpoint. The breakpoint is added to the breakpoints displayed.
    When a system exception is triggered, a warning triangle appears in the line containing the statement that caused it. If you double-click the warning triangle, the internal name of the runtime error appears.
    Static Breakpoints
    You should only use static breakpoints during the development phase of an application. You must remove them from your program before you transport it.
    Setting Breakpoints
    To set a static breakpoint, use the ABAP statement BREAK-POINT . Place the breakpoint in the line at which you want to interrupt the program.
    program RSDEBUG_01.
    if SY-SUBRC 0.
    break-point.
    endif.
    When you run the program, the runtime processor interrupts it when the breakpoints occur. You can number your breakpoints to make them easier to identify ( BREAK-POINT 1, BREAK-POINT 2 …).
    Static breakpoints are not normally user-specific. The program is, therefore, always interrupted as soon as the runtime processor reaches the line containing the breakpoint. The program is interrupted regardless of the user who executes it.
    However, you can set user-specific static breakpoints using the BREAK statement followed by your user name. For example, if you use the statement BREAK SMITH , the program is only interrupted when user Smith runs it. Although user-specific breakpoints appear in the program code, they are not active when other users run the program. You should, however, be careful if an application is being used by several users with the same name.
    Deleting Breakpoints
    Since static breakpoints apply to all users, you must remove them from the program once you have finished testing it. In the ABAP Editor, you can find breakpoints quickly by choosing Utilities ® Global search. You can also use the Extended Program Check to find them.
    If you do not remove static breakpoints from your program, they will be transported to your production system. This could cause serious problems in the production system.
    Dynamic Breakpoints
    You can set up to 30 dynamic breakpoints without changing the program code. Dynamic breakpoints can be set either in the ABAP Editor or directly in the Debugger.
    Setting Dynamic Breakpoints in the ABAP Editor
    You can set dynamic breakpoints in the ABAP Editor regardless of whether you are in display or change mode. You can also set breakpoints directly from within the Debugger at runtime. To set a dynamic breakpoint in the ABAP Editor:
    Position the cursor on the line of the source code at which you want to set the breakpoint.
    Choose Utilities ® Breakpoints ® Set or the Stop icon. The system confirms that the breakpoint has been set.
    To display a list of all dynamic breakpoints in a program, choose Utilities ® Breakpoints ® Display. You can use this list to navigate to a particular breakpoint or to delete one or more breakpoints from the program.
    Setting Dynamic Breakpoints in Debugging Mode
    To set a dynamic breakpoint in the Debugger:
    Position the cursor on the line in which you want to set the breakpoint.
    Select the line by double-clicking it or choosing Breakpoint ® Set/delete.
    The system sets the breakpoint, and displays a small stop sign to the left of the relevant line. If the line already contained a breakpoint, it is deleted.
    When you finish your debugging session, the breakpoint is automatically deleted unless you have explicitly saved it.
    Saving Breakpoints
    If you want to leave the Debugger temporarily, you can save your dynamic breakpoints so that they are still active when you return to the Debugger within the same terminal session.
    To save the breakpoints that you have set in the Debugger:
    Choose Breakpoint ® Save.
    The system saves all of the breakpoints that you have set in the current program. These breakpoints will remain active until you either explicitly delete them or log off from the system.
    You can also delete breakpoints that you have saved:
    By deleting individual breakpoints from the display and then saving again. In this case, only your selected breakpoints will be deleted.
    By choosing Breakpoint ® Delete all. In this case, the system deletes all dynamic breakpoints.
    Managing Dynamic Breakpoints
    The ABAP Debugger provides a convenient user interface for managing breakpoints. To open the breakpoint display, choose Breakpoints, or, from the menu, Goto ® Control debugging ® Breakpoints.
    Example
    Functions
    This display mode contains the following functions for breakpoints:
    Breakpoint Display
    The scrollable breakpoint display contains up to 30 dynamic breakpoints. For breakpoints that you set directly, the program name and line number at which the breakpoint occurs are displayed. For special breakpoint forms, the list displays the statements, events, subroutines, and module calls at which the relevant breakpoints are set.
    Counter
    In the breakpoint display, you can specify a counter. When you use a counter, the breakpoint is not activated until it has been reached a specified number of times. For example, if you enter 5 for the counter, the breakpoint is not activated until it is reached for the fifth time. After the breakpoint has been activated, it remains so, and the counter no longer appears in the breakpoint display.
    Deleting Breakpoints
    Position the cursor on the breakpoint that you want to delete, and either double-click the line or choose Breakpoint ® Set/delete. To delete all breakpoints, choose Breakpoint ® Delete all.
    Activating and Deactivating Breakpoints
    Position the cursor on the breakpoint that you want to activate or deactivate and choose Breakpoint ® Activate/deactivate.
    Regards
    karthik

  • A break problem in java.

    I am making a geography quiz, where a user can choose from 3 different quizzes: either plate tectonics, rivers or rocks. i have saved the questions in a textfile and their related answers in an array. In my quiz i have a set of questions, and i have done a count down timer, so that the questions should be answered within a specific amount of time. If the user doesn't answer the questions within the specified time, it issues a message saying "time over". My problem is that after it displays the message "time over" it continues to display the questions, and so the user can continue answer them, and this is a bit ridiculous. Even though i used a "break" its still not exiting the loop. To work in a good way, it should stop asking questions, and display the result. Can someone pls help me figure out my mistake? Thanks a lot for the help. :-)
    This is the code:
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    import javax.swing.*;
    import java.util.Calendar;
    public class GQ extends JFrame implements ActionListener {
        private static final int FRAME_WIDTH = 140;
        private static final int FRAME_HEIGHT = 160;
        private static final int FRAME_X_ORIGIN = 70;
        private static final int FRAME_Y_ORIGIN = 50;
        AnswerStore answerStore = new AnswerStore();
        boolean timeForMore;
        public static void main (String[] args) {
            JOptionPane.showMessageDialog(null, "This is a Geography Quiz");
            JOptionPane.showMessageDialog(null, "Good Luck");
                GQ frame = new GQ();
                frame.setVisible(true);
        public GQ() {
            Container contentPane;
            JButton button1, button2, button3, button4, button5;
            setSize (FRAME_WIDTH, FRAME_HEIGHT);
            setTitle("Geography Quiz");
            setLocation(FRAME_X_ORIGIN, FRAME_Y_ORIGIN);
            contentPane = getContentPane();
            contentPane.setBackground(Color.pink);
            contentPane.setLayout(new FlowLayout());
            button1 = new JButton("Plate Tectonics");
            button2 = new JButton("Rivers");
            button3 = new JButton("Rocks");
            button4 = new JButton("Quit");
            contentPane.add(button1);
            contentPane.add(button2);
            contentPane.add(button3);
            contentPane.add(button4);
            button1.addActionListener(this);
            button1.setActionCommand("b1");
            button2.addActionListener(this);
            button2.setActionCommand("b2");
            button3.addActionListener(this);
            button3.setActionCommand("b3");
            button4.addActionListener(this);
            button4.setActionCommand("b4");
            setDefaultCloseOperation(EXIT_ON_CLOSE);
         public void actionPerformed(ActionEvent e) {
            String ac = e.getActionCommand();
            String[] questions = null;
            String[] answers = null;
            if (ac.equals("b1")) {
                questions = readFile("plate_tectonics.txt");
                answers = answerStore.tectonicAnswers;
            } else if(ac.equals("b2")) {
                questions = readFile("rivers.txt");
                answers = answerStore.riverAnswers;
            } else if(ac.equals("b3")) {
                questions = readFile("rocks.txt");
                answers = answerStore.rockAnswers;
            } else if (ac.equals("b4")) {
                System.exit(0);
             askQuestions(questions, answers);
        public void stopAndShowResults() {
            timeForMore = false;
        private String[] readFile(String path) {
            Scanner s = null;
            StringBuilder sb = new StringBuilder();
            String separator = "\n";
            try {
                s = new Scanner(new BufferedReader(new FileReader(path)));
                while (s.hasNext()) {
                    sb.append(s.nextLine() + separator);
            } catch(IOException e) {
                System.out.println("read error: " + e.getMessage());
            } finally {
                if (s != null)
                    s.close();
        private void askQuestions(String[] questions, String[] answers) {
            int count = 0;
            int point = 0;
            for(int j = 0; j < questions.length; j++) {
                String input = JOptionPane.showInputDialog(null, questions[j]);
                if(answers[j].equals(input))
                    count++;
                    point++;
                    timeForMore = true;
                else if(timeForMore=false)
                    break; // here its not breaking. Is there something wrong here?
                JOptionPane.showMessageDialog(null, "You answered " + count +
                                          " out of " + questions.length +
                                          " questions correctly.");
                JOptionPane.showMessageDialog(null, "Your Geography Quiz score is " + ((point*100)/10) + " % ");
              if(point>=0 && point<=3)
                  JOptionPane.showMessageDialog(null, "You need to Improve");
             if(point>=4 && point<=7)
                  JOptionPane.showMessageDialog(null, "Good");
               if(point>=8 && point<=10)
                  JOptionPane.showMessageDialog(null, "You did Great");
    class AnswerStore  {
        String[] tectonicAnswers = {
            "Hellenic", "destructive", "100km", "Italy", "Wegner",
            "Mariana", "Sicily", "created", "constructive", "Mediterranean"
        String[] riverAnswers = {
            "Gorges", "Meanders", "Levees", "Yes", "Less Economic Developed Countries",
            "crescent shaped lakes", "More Economic Developed Countries", "No", "River Discharge", "No"
        String[] rockAnswers = {
            "40km", "Igneous Rock", "Sedimentary", "Basalt", "Organic",
            "pressure", "Oolites", "Igneous", "dark black", "basalt"
    }Thanks again for help.

    From the language specification:
    http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#15.26
    At run time, the result of the assignment expression is the value of the variable after the assignment has occurred. The result of an assignment expression is not itself a variable.
    In your code, you have an assignment, not a comparison in your if condition:
                else if(timeForMore=false)When the else if condition is evaluated, timeForMore gets set to false, but then the else if block doesn't evaluate, because the condition's value was false. So the break statement is always skipped. Make it a comparison with == and it will work the way you expect.

  • Execution of BEx Query Designer Querys in BI Java SDK

    Hello experts,
    i am actually occupying with the possibilities of the BI Java SDK. I checked the documentation but could not find an answer to my question, so i address this issue now to the community in the hope, that someone out there can give me a hint:
    Is it possible to execute a BI query, which was designed in the BEx query designer, within the BI Java SDK OLAP query api?
    Is  there somewhere a method, which could be simply passed the technical names of the infocube and  the query and then returns the query result as a IBIResultSet or IBIDataSet?
    Thanks in advance for your help,
    best regards,
    Thilo

    Hello Mohan,
    thanks for this impression - thats a way i didn't think about at all before. I even think, that it is not necessary to publish the query as iview - it would suffice to invoke the BEx-AdHoc-Analysis Service via a HttpConnection-Object within a servlet and then parse the result delivered by the BEx service. You won't even need BI Java SDK for this, since this is plain Java functionality.
    But as i see there seems to exist no BI Java SDK-"generic" possibility to invoke an existing query as i see....
    If anybody has got another idea, it is very welcome. But i think i will investigate on the approach with the native HTTP call to AdHoc Service.
    Thanks anyway & best regards,
    Thilo

  • How to isolate the Sql Statement from Java Code

    Hi
    I Need to know that can we segregate the Sql Statements and convert them to Stored Procedures so as to isolate the Sql statements from Java Code.
    So i have one static web page which uses four select Statements so what i want is to create a stored procedure encapsulating these queries. So that the Java Web Developer will simply call the Stored Procedure instead of using four different SQL Statements.
    Suppose the developer has these four Statements
    Select ename,empno,sal,job from emp;
    select empno,ename,mgr from emp;
    select deptno,dname from dept;
    select emp.ename,emp.empno,emp.deptno,dept,dname fromemp,dept;
    So can i encapsulate these four Sql Statements in one Procedure and the Web developer can call the Store procedure and dont need to write the Sql Statements in his code.
    Can Anybody guide me how to write this Stored type of Store procedure.
    Thanks

    http://www.google.com/search?q=java+windows+registry
    Next time, search yourself. It might be beyond your belief, but you're really, really not the first person to wonder about this.

  • Control Break Statements ----- Please Help me

    I have some idea about the control-break statements(AT-ENDAT). Can any one please give me the example ?
    Thanks in Advance. Points will be rewarded immediately.

    sample program for AT events
    Using AT FIRST , AT NEW, AT THE END OF , AT LAST.
    DATA: BEGIN OF ITAB OCCURS 0,
    F1 TYPE I,
    F2(6) TYPE C,
    F3(10) TYPE N,
    F4(16) TYPE P DECIMALS 2,
    END OF ITAB.
    DATA: SUB_TOT(10) TYPE P DECIMALS 3.
    **--1
    ITAB-F1 = 1.
    ITAB-F2 = 'ONE'.
    ITAB-F3 = 10.
    ITAB-F4 = '1000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 1.
    ITAB-F2 = 'ONE'.
    ITAB-F3 = 20.
    ITAB-F4 = '2000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 1.
    ITAB-F2 = 'ONE'.
    ITAB-F3 = 30.
    ITAB-F4 = '3000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    *--2
    ITAB-F1 = 2.
    ITAB-F2 = 'TWO'.
    ITAB-F3 = 10.
    ITAB-F4 = '1000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 2.
    ITAB-F2 = 'TWO'.
    ITAB-F3 = 20.
    ITAB-F4 = '2000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 3.
    ITAB-F2 = 'THREE'.
    ITAB-F3 = 10.
    ITAB-F4 = '1000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    ITAB-F1 = 3.
    ITAB-F2 = 'THREE'.
    ITAB-F3 = 20.
    ITAB-F4 = '2000.00'.
    APPEND ITAB.
    CLEAR ITAB.
    SORT ITAB BY F1.
    LOOP AT ITAB.
    AT FIRST.
    WRITE: /35 ' MATERIAL DETAILS:'.
    ULINE.
    ENDAT.
    AT NEW F1.
    WRITE: / 'DETAILS OF MATERIAL:' COLOR 7 , ITAB-F1.
    ULINE.
    ENDAT.
    WRITE: / ITAB-F1, ITAB-F2, ITAB-F3, ITAB-F4.
    SUB_TOT = SUB_TOT + ITAB-F4.
    AT END OF F1.
    ULINE.
    WRITE: / 'SUB TOTAL :' COLOR 3 INVERSE ON, SUB_TOT COLOR 3 INVERSE ON.
    CLEAR SUB_TOT.
    ENDAT.
    AT LAST.
    SUM.
    ULINE.
    WRITE: 'SUM:', ITAB-F4.
    ULINE.
    ENDAT.
    ENDLOOP.
    Reward points if helpful.
    Rgds,
    Abhishek

  • UDF help -break statement

    Hi all,
    I have a problem with my UDF. <i>A break statement doesnt break out of the for loop. </i>Please go thru the follwing and offer your helping hand.
    <b>The Issue:</b>
    In need to <i>check the value of a "child" element for each occurrence of the parent node </i>and if the condition is true then <i>map the value of "1" to the target element </i>with the same name and a same parent.
    <b>Source Structure:</b>                 
    ParentNode1 <1..1>                        
    ...Child Node1 <1.unbounded>             
      .... Flag_Source  <1.1> 
    <b> Target Structure</b>
    ParentNode1 <1..1>
    ....Child Node <1. unbounded>
    Flag_Target <1.1.>    Mapping
    <b>GUI Mapping:    </b>                  
    (Flag Source) -
    [UDF]>>>>>>FlagTarget
                                        ^-
    (ChildNode1) -
    ^
    <b>Condition:</b>
    for each child node1
    If ParentNode1>ChildNode1>FlagSource = 1
    then Flag-Target = 1
    <b>Global Integer Element flag</b>
    int flag;
    <b>UDF:</b>
    <i>Info:</i> Type is Context;
    Takes 2 Arguments
    1. Flag_Source- <i>Context Set to ParentNode</i>
    2.ChildNode1
    AbstractTrace trace = container.getTrace();
    for ( int j = 1; j < ChildNode1.length; j++)<i>
         if ( Flag_Source[j].equals(" 1")){ 
         trace.addInfo("retrieved the value"+Flag_Source[j]);
                    flag = 1;
                   break;  <b>// the for loop does not terminate here</b>
           }else
           flag= 0;
    if ( flag == 1) {
    result.addValue("1");
    else
    result.addValue("0");
    <b>Testing</b>
    Also when i test the mapping , I get the following error
    <b>
    "Cannot produce target element..
    Check xml instance is valid for source xsd and target-field mapping fulfills..."</b>
    Please help me with your suggestions
    Thanks
    regards
    krishna

    Hi all,
    I have successfully mapped the source to the target.
    I was working simultaneously on the issue. I just saw your responses and i appreciate all of your feedback.
    Mudit,
    As per your soultion, I would not achieve the desire result because I need to read the value of "flag_source" for every instance of childnode1 and i can only achieve this by havin
    ffor(int i=0; i< childnode1.length;i++) and not flagnode.length as you have suggested.
    Samarajit,
    Nice observation about the blanks space:)  but you know what I spent a lot of time just to figure that there was a blank comming up before 1:)
    Amit,
    Your solution closely matches up my "Working" function though I had to fix some context related issues. I used "SplitByValue"for that .
    Thank you all again for your inputs
    Regards
    krishna

  • Dynamic Query and Collect Statement.

    Hi Gurus....
    Please explain me how to write dynamic Query,,, Pl. give me with example.
    Also would like to know basics of Collect statement and it's use..
    Thanks
    Ritesh

    Hi Ritesh,
    COLLECT is used to create unique or compressed datsets. The key fields are the default key fields of the internal table itab . If all non-numeric fields are same in the internal table then it will add numeric fields and maintains a single entry
    If you use only COLLECT to fill an internal table, COLLECT makes sure that the internal table does not contain two entries with the same default key fields.
    Check this link to know about COLLECT statement
    http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/collect.htm
    Dynamic query can be built in SAP with the help of () values.
    DATA:
    V_TABNAME TYPE DDO2L-TABNAME,
    V_CONDTION TYPE STRING.
    V_TABNAME = 'MARA'.
    V_CONDTION = 'MATNR LIKE 'S*'.
    SELECT MATNR
      FROM <b>(V_TABNAME)</b>
      INTO TABLE ITAB
    WHERE <b>(V_CONDTION)</b>.
    Thanks,
    Vinay

  • Urgent query about copying array of objects to html item

    I have an urgent query about how I can display an array of objects on a html form. The only suitable html item I can see for this is a drop down box. Ideally a combo box would be preferable but I cant find anything like this. Basically the display item needs to contain 3 columns of data and has to display a number of rows. Can anyone tell me how to copy the array of values into a drop down box?

    Here is all the code from my jsp. It keeps returning null:
    <%@ page language="java" %>
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ page import="java.util.*, java.lang.*" %>
    <html:html locale="true">
    <head>
    <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"/>
    <link rel="stylesheet" type="text/css" name="timesheet" href="stylesheets/timesheet.css"></link>
    <script type="text/javascript" language="javascript" src="javascript/sum.js"></script>
    <title><bean:message key="eng.title"/></title>
    <html:base/>
    </head>
    <body bgcolor="white">
    <table border="0" width="100%">
    <tr>
    <td width="30%"><html:img page="/images/PwC_logo.gif"/></td>
    <td width="40%" class="applicationTitleCell">
    <div align="center">
    <bean:message key="application.title"/>
    </div>
    </td>
    <td width="30%"> </td>
    </tr>
    </table>
    <center>
    <html:form action="/selectEng" focus="engSearchNumber">
    <table border="0" width="100%">
    <tr>
    <td width="30%"></td>
    <td width="20%" align="center"> <b> <bean:message key="eng.prompt.engSearchNumber"/> </b> </td>
    <td width="20%" align="center"> <b> <bean:message key="eng.prompt.clientSearchName"/> </b> </td>
    <td width="40%">   </td>
    </tr>
    <tr>
    <td width="30%"></td>
    <td width="20%" align="center"> <html:text property="engSearchNumber" size="20" maxlength="9" onchange='<%= "SearchLength(this)" %>' onkeypress="return NumberOnly()" /> </td>
    <td width="20%" align="center"> <html:text property="clientSearchName" size="20" maxlength="20" onchange='<%= "SearchLength(this)" %>'/> </td>
    <td width="30%">   </td>
    </tr>
    </table>
    <table border="0" width="100%">
    <tr>
    <td width="30%"></td>
    <td width="40%" align="center"><html:image property="findButton" src="images/Find.gif" alt="Find"/></td>
    <td width="30%">   </td>
    </tr>
    <jsp:useBean id="selectEngForm" scope="session" class="Time.SelectEngForm" />
    <% if (selectEngForm.getEngSearchNumber() != null) { %>
    <tr>
    <td width="30%"></td>
    <td width="40%" align="center"><select name="engListing" size="5">
    <%= selectEngForm.getEngListing() %>
    </select></td>
    <td width="30%">   </td>
    </tr>
    <% } else if (selectEngForm.getClientSearchName()!=null){ %>
    <tr>
    <td width="30%"></td>
    <td width="40%" align="center"><select name="engListing" size="5">
    <%= selectEngForm.getEngListing()%>
    </select></td>
    <td width="30%">   </td>
    </tr>
    <% } %>
    <%=request.getParameter("engListing")%>
    </table>
    <br><br>
    <table border="0" width="100%">
    <tr>
    <td width="30%"></td>
    <td width="11%" align="center"> <html:image property="addButton" src="images/Add.gif" alt="Add the selected engagement to the timesheet"/> </td>
    <td width="11%" align="center"> <html:image property="cancelButton" src="images/Cancel.gif" alt="Cancel"/> </td>
    <td width="30%">   </td>
    </tr>
    </table>
    </html:form>
    </center>
    <br>
    <center><html:link forward="timesheet"> <html:img src="images/Back.gif" border="0"/> </html:link></center>
    </body>
    </html:html>

  • Query about building forums using JSP

    Hi everybody here . I hope you are fine and you are doing better .
    I have a query about JSP ,I see SUN forums here is built using JSP , I want to know What the Probability to build an open source Forum using JSP like those built with PHP For example : PHPBB and other examples .
    On other query If there is already Forums built using JSP , What is this Forum ?
    Thank you very much at all
    Edited by: ahmedhussien on Jun 17, 2009 5:11 PM

    Scroll a bit down and check the "powered by" logo.
    An alternative is JForum. Just google "java forum software" or something straightforward like that..

  • Query about Frame maker 11

    Hi All
    This is regarding a query about Frame maker 11.
    I have seen the in the FDK guide of FM 11 which states that  "To compile FDK clients for Windows, you must use Microsoft Visual Studio 2010."
    So do we need a separate installation of  Microsoft Visual Studio 2010 in order to develop/compile  FDK clients apart from FM11 installation  or is its a part of FM11 software?
    could you please any one can clarify on this .
    Thank you .
    Regards
    Ramesh

    AFAIK, you have to supply your own IDE & compiler.

Maybe you are looking for

  • How to find the number simultaneous call at a given moment on UCCX ?

    Hello, I would to know how to find the number simultaneous call at a given moment on UCCX ? it's on UCCX or UCCX RTMT, I don't know thanks a lot for your help. Aubert

  • I am trying to use boot camp to partition my mac... and failing.

    Every time I try to partition my mac going through the bootcamp steps it keeps telling me that "Your bootable USB drive could not be created, An error occurred while copying the Windows installation files."  I found a video that shows how to fix this

  • Use of Further Participants in an Appraisal Template

    Hi experts, What is the use of Further Participants in an Appraisal Template? I have designed appraisal templates which have two levels of appraisers, but did not use Further Participants in it. When should be Further Particpants used and when is tha

  • Creating a wireless access point on a wired ethernet

    I am spending a month in Italy and will have a wired internet connection in my apartment. I would like to connect my Airport Express to it so that I can use my iPhone in the wi-fi mode to save on AT&T data charges. I know that this configuration is p

  • Private or hidden folder in iPhoto

    I am curious to know if there is a way to make a private or hidden folder in iPhoto for pictures that you would not like the general public to see when they bring up your iPhoto library. Or, is there a way to keep certain pictures from showing up in