Need help with Loop Statements!!!

Hi
im a student just starting to learn Java. I have an assignment but am stuck on the folowing question:
"Describe the operation of the 'for' loop Flow Control statement explaining the function of the initialisation, conditional and iteration parts.
Also describe the operation for the 'while' loop Flow Control statement expaling the function of the initialisation, conditional and iteration parts."
Could someone please help answer it?
(Ive looked in some books but cant find much on asnwering it)
Any help would be much appreciated!
Thanks

"Could someone please help answer it?
(Ive looked in some books but cant find much on asnwering it)" - Yes
put this into a for loop so that it takes any number of arguments from the command line - eg
my name is Susie Woosie Floosie (and any number of additional names)
at present it will only output - eg
my name is Susie Woosie
public class forLoop{
   public static void main (String []args) {
      String firstName = args[0];
      String secondName = args[1];
      System.out.println("my name is "+firstName+" "+secondName);

Similar Messages

  • I need Help with loop

    Hello everyone this is my first time posting here, i have always find java easy(up to this point), this is my first class in programming java i am just needing help with the "for loops" i cant seem to get the program generate 10 random math questions. if you guys can please help i will appreciate it, i have been working on it for a couple of hours. I am not finished with it yet but thats the only thing i need help with.
    import javax.swing.JOptionPane;
    public class Lab5
    public static void main(String[] args)
    int num1 = (int) (Math.random() * 100 + 1);
    int num2 = (int) (Math.random() * 100 + 1);
    int sum = num1 + num2;
    int product = num1 * num2;
    int quotient = num1 / num2;
    int difference = num1 - num2;
    for (int i = 0; i > 11; i++);
    int number = (int)(Math.random()*4);
    if (number == 0 )
    String s1 = JOptionPane.showInputDialog(null, num1 + " + " + num2 + "=" );
    if(number == 1)
    String s3 = JOptionPane.showInputDialog(null, num1 + " - " + num2 + "=" );
    if(number == 2)
    String s3 = JOptionPane.showInputDialog(null, num1 + " x " + num2 + "=" );
    if(number == 3)
    String s4 = JOptionPane.showInputDialog(null, num1 + " ÷ " + num2 + "=" );

    for (int i = 0; i > 11; i++);Two problems with this line:
    1) The second part of a For loop is the constraint. You have said that for the loop to be entered, i must be greater than 11. Well since you've also told i to begin at 0, this will never happen. Thus, the loop will never enter. You may have meant less than?
    2) You put a semicolon in the line. Semicolons are used to end statements. The For loop, when used as a block with curly braces, is not a single statement and does not require a semicolon. Here's the two structures of a basic For loop:
    for(int i = 0; i <= 100; i++) {
        //this is a block. you can put multiple statements in here and they are all part of the loop
        int a = 1;
        int b = i;
    //if your loop only needs to use a single statement, no braces are required
    for(int i = 0; i <= 100; i++)
        int a = i;

  • Need help with Object States or Buttons?

    I currently work in InDesign to compile layouts and present design decks to clients. Our template includes an approval section (Not Approved, Revised, Approved) that we currently have as white/black bubbles that we change manually on each page. I've been trying to find a way to speed up this process. I know that in InDesign you can create buttons than you can then click on-off on your PDF - we used to do this but it is too time consuming (we have PDF's anywhere from 25-120 pages). I have been playing around with Object States, so we can quickly update the bubbles in InDesign itself as we work.
    Does anyone know of a way to change the state of multiple objects on multiple pages at the same time? (For example, if I want to change all pages to "Approved" at the same time - or if I only wanted to do some, but not all, of the pages.)
    Can anyone recommend any other InDesign tools that may be able to create a similar function for an "approval" stamp, but that still is done in InDesign (not in the PDF after exporting)?

    I was hoping that wouldn't be the only way. My have multiple master pages already, and not all pages will be "approved" at the same time. So we've run into issues with putting these on the masters as it gets easier to miss them.

  • Need help with If statement Please

    Hi guys,
    This is my first time posting and sorry if for some reason i post incorrectly.
    I am having trouble figuring out what I am doing with my if Statement and why the compiler is giving me an error which says 'cannot find symbol';
    Just incase you need to see the code here it is. And please any pointers would help me get back on track. And please dont laugh at the novice code i just started^^;
    import java.util.*;
    import java.text.*;
    public class Student
         public static void main(String[]args)
         Scanner scan=new Scanner(System.in);
         double std1, std2, std3, num1, num2, num3, num4;
         String a, answer1, name1;
    System.out.println("Welcome to _____ program, press any button to continue: ")
    a=scan.nextLine();
    System.out.println("Good, would you like to enter a grade for a student(y/n)?");
    answer1=scan.nextLine();
    if (answer1 == y)
         System.out.println("Please enter the students name ");
                             name1=scan.nextLine();
                             System.out.println("Please label the test number ");
                             num1=scan.nextDouble();
                             System.out.println("Please enter the grade, "+name1+" recieved");
    std1=scan.nextDouble();
    if (answer1==n)
         System.out.println("Thank you for trying my program ");
    else
    System.out.println("It's obvious you couldn't follow a simple direction good bye ");

    Thanks Flounder,
    I'll keep in mind to edit the code the way you told me too.
    As far as the code goes, what do you mean 'y' is not a string and should be a variable. All I'm trying to do is give a true false statement.
    For example
    if (input==y)
    System.out.println("________");
    And in my code it gives an error stating that y is a variable.
    I dont understand why.
    Thanks much for all your replies.

  • Need help with loop cursor

    Hi,
    I'm doing a data conversion and am fairly new to PL/SQL.
    I have a cursor and in the loop i have a select statement
    which returns ORA-01403(no data found). I need to skip this
    row in the cursor and continue with the next.
    BEGIN
    OPEN cur_fill_split;
    LOOP
    FETCH cur_fill_split into S_ASR,S_CLIENT_NO, S_DIRCODE, S_SPLIT_RATE, I_WAYS,
    S_BRANCH_NUMBER, S_BRANCH_NAME, S_DIV_NUMBER, S_DIV_NAME, S_ITEMCODE, S_LINE;
    EXIT WHEN cur_fill_split%NOTFOUND;
    select order_number INTO N_ORDER_NUMBER from order_header
    where cmr_number||client_number||dir_number = s_asr||s_client_no||s_dircode;
    SELECT SEQ INTO I_SEQ FROM ORDER_DETAIL
    WHERE ORDER_NUMBER = N_ORDER_NUMBER
    AND LINE_ORDER_NUMBER = TO_NUMBER(S_LINE);
    ********(errors on the above select)********
    END LOOP;
    CLOSE cur_fill_split;
    END;
    Thanks,
    Brian

    Hi,
    I think there r 2 methods, one is by giving begin - end inside the loop as shown below 1st ex:
    & the 2nd method is by selecting the record count & then based on that value executing further commands.
    I think 2nd method is more safer than the 1st method.
    Method 1:
    1)
    -- ---------------Procedure Begin------------------
    BEGIN
    OPEN cur_fill_split;
    LOOP
    FETCH cur_fill_split into S_ASR,S_CLIENT_NO, S_DIRCODE, S_SPLIT_RATE, I_WAYS,
    S_BRANCH_NUMBER, S_BRANCH_NAME, S_DIV_NUMBER, S_DIV_NAME, S_ITEMCODE, S_LINE;
    EXIT WHEN cur_fill_split%NOTFOUND;
    select order_number INTO N_ORDER_NUMBER from order_header
    where cmr_number||client_number||dir_number = s_asr||s_client_no||s_dircode;
    BEGIN
    SELECT SEQ INTO I_SEQ FROM ORDER_DETAIL
    WHERE ORDER_NUMBER = N_ORDER_NUMBER
    AND LINE_ORDER_NUMBER = TO_NUMBER(S_LINE);
    EXCEPTION
    WHEN NO_DATA_FOUND THEN
    NULL;
    END;
    END LOOP;
    CLOSE cur_fill_split;
    END;
    -- ---------------Procedure End------------------
    Method 2)
    By selecting the record count & based on that records, deciding the program control.
    -- ---------------Procedure Begin------------------
    declare
    rec_cnt number := 0;
    BEGIN
    OPEN cur_fill_split;
    LOOP
    FETCH cur_fill_split into S_ASR,S_CLIENT_NO, S_DIRCODE, S_SPLIT_RATE, I_WAYS,
    S_BRANCH_NUMBER, S_BRANCH_NAME, S_DIV_NUMBER, S_DIV_NAME, S_ITEMCODE, S_LINE;
    EXIT WHEN cur_fill_split%NOTFOUND;
    select order_number INTO N_ORDER_NUMBER from order_header
    where cmr_number||client_number||dir_number = s_asr||s_client_no||s_dircode;
    /* Here we are using cnt variable & checking for
    the record count, if count = 0, then it will skip */
    select count(*) into rec_cnt from ORDER_DETAIL
    WHERE ORDER_NUMBER = N_ORDER_NUMBER
    AND LINE_ORDER_NUMBER = TO_NUMBER(S_LINE);
    if rec_cnt > 0 then
    SELECT SEQ INTO I_SEQ FROM ORDER_DETAIL
    WHERE ORDER_NUMBER = N_ORDER_NUMBER
    AND LINE_ORDER_NUMBER = TO_NUMBER(S_LINE);
    end if;
    END LOOP;
    CLOSE cur_fill_split;
    END;
    -- ---------------Procedure End------------------
    Try it out & mail me
    Good luck

  • Need help with update statement with multiple joins

    I've got the following select statement that is pulling 29 records:
    SELECT
    PPA.PROJECT_ID,
    PPA.SEGMENT1,
    peia.expenditure_item_id,
    peia.expenditure_type,
    pec.expenditure_comment
    FROM PA.PA_PROJECTS_ALL PPA,
    pa.pa_expenditure_items_all peia,
    pa.pa_expenditure_comments pec
    where PPA.segment1 < '2008' and
    PPA.project_id = 52 and -- just run for project # 20077119 for testing
    peia.expenditure_type = 'PAYROLL' and
    peia.project_id = ppa.project_id and
    PEC.EXPENDITURE_ITEM_ID = PEIA.EXPENDITURE_ITEM_ID;
    I need to update the pec.expenditure_comments to a static field for those 29 records. I assume I should start with the following, but not sure how to complete the where:
    update
    pa.pa_expenditure_comments pec
    set pec.expenditure_comment = 'REFERENCE HD#728'
    where
    First time that we've ever needed to update, so any and all help appreciated.

    Try using exists:
    update pa.pa_expenditure_comments pec
    set    pec.expenditure_comment = 'REFERENCE HD#728'
    where exists ( select null
                   from   pa.pa_projects_all ppa
                   ,      pa.pa_expenditure_items_all peia
                   ,      pa.pa_expenditure_comments pec2
                   where  ppa.segment1 < ''    -- not sure what you posted here, so for next time:
                                               -- please put your examples between the code tags.
                   and    ppa.project_id = 52  -- just run for project # 20077119 for testing
                   and    peia.expenditure_type = 'PAYROLL'
                   and    peia.project_id = ppa.project_id
                   and    pec2.expenditure_item_id = peia.expenditure_item_id
                   and    pec2.expenditure_item_id = pec.expenditure_item_id
                 );

  • Need help with IF Statement!!!

    I am trying to write an IF statement using FormCalc in LiveCycle. I have cell "tpe" which captures total points. I would like to assign levels based on the number of points achieved. For example, level I = 1001-1985; level II = 851-1000; level III = 551-850; level IV = <551. I want cell "level" to show either I, II, III or IV, based on the points in cell "tpe". How can I do this? I have zero familiarity with FormCalc or scrips in general. Can someone please help me with this? Would appreciate any help!! Thanks!

    This is what it says:
    topmostSubform.Page3.tpe::calculate - (FormCalc, client)
    sum (rrtotal, programtotal, financetotal, leadershiptotal, executivetotal, meetingstotal, filestotal, brotherhoodtotal, conferencetotal, communicationstotal, minutestotal, standardstotal, basileustotal, abtotal, gramtotal, antigramtotal, tamtotal, pgramtotal, partotal, epistotal, torchtotal, hodtotal, phitotal)
    if ($ > 1000 and $ <= 1985)then
    level = "I"
    elseif ($ > 850 and $ <= 1000)then
    level = "II"
    elseif ($ > 550 and $ <= 850)then
    level = "III"
    elseif ($ <= 550)then
    level = "IV"
    else level = ""
    endif

  • Need help with select statement or query

    Not familiar with what to call it, but here is what i need...
    To give our analyst a better idea of warranty on some of our
    equipment, i
    would like to add to the page a column that displays if the
    device is still
    under warranty
    I currently capture the date the equipment was returned from
    repair, so what
    could i use within my select statement or query to display a
    warranty
    expiration date or display on the page...
    example :
    Returned from repair 10/20/2006 warranty expires on
    11/20/2006
    each equipment has different warranties, so i need a formula
    or something to
    say... device #1 has 60 day warranty ( so 10/20/2006 + 60days
    =
    12/19/2006 )
    I would imagine this to be a query
    Table 1 would contain the equipment type and warranty time
    Table 2 would contain the current status of the equipment
    Query would take the back from repair date + warranty =
    expiration date

    Simple. Join the two tables and create a derived column for
    the expiration date. The exact syntax is dependant on your DBMS, so
    check the manual for whichever you are using and look at the date
    functions. There will be a function that will allow you to add a
    number of date units (day, month, year, etc) to a date
    field.

  • Need help with if statements involving strings.

    For this code, assume that I input a value that would make the boolean statement true. For some reason, this program will never return true. Can somebody please help me?
    Scanner scan = new Scanner(System.in);
    String personPlay;
    boolean loop=false;
    System.out.print("Enter a proper string(RPS): ");
    personPlay=scan.nextLine();
              if (personPlay=="R"||personPlay=="P"||personPlay=="S")
                   loop=true;

    Don't use == to compare Strings. use .equals
    if(personPlay.equals("R") || personPlay.equals("P") || personPlay.equals("S"))
         loop = true;
    }

  • Need help with provide statement in pnp progrm

    hi experts,
    i need to select all the records that :
    1. pa00014-sunty in so_subty.
    base on the records that he found' i need to select from pa0001:
    p0014-endda = > p0001-begda and
    p0014-begda = < p0001-endda and
    p0001-persk ne so_persk.
    what i did:
    provide * from p0001
    from p0014
    between pn-begda and pn-endda
    where p0014-subty = so_subty  and
    p0014-endda = > p0001-begda and
    p0014-begda = < p0001-endda and
    p0001-persk ne so_persk.
    check p0001_valid = 'X'.
    endprovide.
    i got 2 problems:
    1. i not recognize the syntax: check p0001_valid = 'X'.
    2. the syntax for the provide is not good.
    i new in pnp thing.
    i hope i was clear.
    thanks in advanced,
    Michal.

    Hi,
       May be this code will help you.
    infotypes: 0001,0002,0008,0000,1000,0021,0041,0587 .
    PROVIDE ename BTRTL PLANS STELL ORGEH ABKRS FROM P0001 BETWEEN PN-BEGDA AND PN-ENDDA  .
    if p0001-begda = '20070801' .
          IT_FINAL-ORGEH = P0001-ORGEH .
          IT_FINAL-STELL = P0001-STELL .                            "   JOB
          IT_FINAL-PLANS = P0001-PLANS .                            "   POSITION
          IT_FINAL-ename = P0001-ename .                            "   personnel name
          IT_FINAL-BTRTL = P0001-BTRTL .                            "   DEPARTMENT
          IT_FINAL-ABKRS = P0001-ABKRS .                            "   PAYROLL AREA
          APPEND IT_FINAL .
    endif .
    ENDPROVIDE.
    PROVIDE GBDAT GESCH FROM P0002 BETWEEN PN-BEGDA AND PN-ENDDA .
           IT_FINAL-GBDAT = P0002-GBDAT  .                            "   DOB
           IT_FINAL-GESCH = P0002-GESCH  .                            "   ***
         IF IT_FINAL-GESCH = 1   .
           IT_FINAL-GTXT  = 'M'  .
         ELSE.
           IT_FINAL-GTXT  = 'F'  .
         ENDIF .
           APPEND IT_FINAL .
    ENDPROVIDE .
    PROVIDE TRFST FROM P0008 BETWEEN PN-BEGDA AND PN-ENDDA.
            IT_FINAL-TRFST = P0008-TRFST .                          "   personnel level
            APPEND IT_FINAL .
    ENDPROVIDE.
    PROVIDE  FAVOR FANAM FROM P0021 BETWEEN PN-BEGDA AND PN-ENDDA where P0021-pernr = pernr-pernr
      and  p0021-SUBTY = '11' .
           IT_FINAL-FAVOR  = P0021-FAVOR .                          "   FATHER'S NAME
           IT_FINAL-FANAM  = P0021-FANAM .
           CONCATENATE IT_FINAL-FAVOR IT_FINAL-FANAM  INTO IT_FINAL-FNAME .
           APPEND IT_FINAL .
    ENDPROVIDE.
    Regards,
    Himanshu

  • Need help with loops! Where can I find them?

    I have garageband '09 and when I go through my loops, over half of them are missing. That is to say they are labeled and there is a list of them, but only half work, The rest of them are see-through text and wont play music. It has said I could get them back with a software update but it always comes back that everything is up to date. im wondering if they might be in a folder and garageband doesnt know of that folder as where to look or what. Any Ideas please??

    Bachman22 wrote:
    only half work, The rest of them are see-through text and wont play music. It has said I could get them back with a software update
    http://www.bulletsandbones.com/GB/GBFAQ.html#cantdownloadloops
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • Need help with looping/repeat webpage in Apple Script

    I would like to repeat an action in AppleScript by opening up a URL page in Safari, closing it, and then re-opening it again.
    Can someone please help me with this action? Please be very specific in your response. I am not very familiar with this program.
    Thank you

    tell application "Safari"
        repeat with theURL in theURLs
            make new document
            set URL of front document to theURL
            delay 1
            repeat until ((do JavaScript "document.readyState" in front document) is "complete")
                delay 1
            end repeat
            close front document
        end repeat
    end tell
    This is what I have so far..but it is not working. It only opens it up ONCE. What I want is for the web page to repeatedly be generating every 1 or 2 seconds, after it closes out the previous one.
    I want only ONE website continously being opened up.
    Someone help please!!

  • Need help with loop

    The script below analyses an indesign doc for missing links and then places library asset on the page, cuts and "pastes into" any frame with a missing link (the cut and paste thing sucks, but we can't figure out any other way to avoid an external image source for the missing pic placeholder graphic). The loop finds the missing links except for 2. If there are 5 missing links, it finds 3. If there are 10 missing links, it finds 8...etc. Why won't it catch them all?
    Script below:
    myCheckGraphics();
    function myCheckGraphics(){
             myDocument=app.activeDocument;
            for(var myCounter = 0; myCounter < myDocument.allGraphics.length; myCounter++){
                var myGraphic = myDocument.allGraphics[myCounter];
                if(myGraphic.itemLink.status == LinkStatus.LINK_MISSING){
                    var myLib=app.libraries.item("Missing Link.indl");
                if(File.fs == "Macintosh"){
                    var myLibPath=app.open(File("/Applications/Adobe Indesign CS3/Cover Setup/Missing Link.indl"));
                else{
                myLibPath=app.open(File("/c/Program%20Files/Adobe/Cover Setup/Missing Link.indl"));
                var selectMiss=app.select(myGraphic);   
                missLink=app.selection[0].parent;
                var selectBox=app.select(missLink);
                var myX=missLink.visibleBounds;
                var myTop=myX[0];
                var myLeft=myX[1];
                var myBottom=myX[2];
                var myRight=myX[3];
                var myWide=myRight-myLeft;
                var myBigBottom=myBottom-myTop;
                if((myWide>35)||(myBigBottom>20)){
                    myAss=myLib.assets.item("Missing Link Big");
                else if((myWide>15)||(myBigBottom>10)){
                    myAss=myLib.assets.item("Missing Link Medium");
                else{
                    myAss=myLib.assets.item("Missing Link Small");
                    myMissAlert();
                    }//end if missing link
                }//end for loop
        function myMissAlert(){
            ////place the asset.//////
            myAss.placeAsset (myDocument) ;
            var myAsset=myDocument.pageItems.item("Missing Link");
            var selectAss=app.select(myAsset);
            var myDupe = app.copy() ;
            var det=myAsset.remove();
            var selectBox=app.select(missLink);
            var myPaste=app.pasteInto()
            app.select(NothingEnum.nothing, undefined);

    A fairly recurrent "problem" with Indesign.
    The loop checks for missing links on an array of images. However, as soon as you correct one of these links, the array it's checking gets updated in the background, so the loop seems to skip every other image!
    Suppose you have an array
    missingLinks = [ "a", "b", "c" ]
    (where all are missing) and you loop from 0 to 2. The first one checks #0 and corrects it. Now the array will change (in the background) to
    ["b", "c"]
    ... and your loop happily continues with #1 -- "c".
    The common solution is to loop over the array backwards:
    for(var myCounter = myDocument.allGraphics.length-1; myCounter >= 0; myCounter--)
    Notice you have to use "length - 1" and check "myCounter >= 0", because the array elements are numbered from 0 to length-1 -- perfectly logical for a computer, somewhat less so for a human. The regular forwards loop does exactly the same, but it's a bit more 'hidden' from casual inspection.

  • Need help with session state/item refresh

    I have an application that allows users to record productivity information for our employees. There are different types of work they have to do, so the form is in header/multiple-detail form and uses collections to handle all processing. In the header portion are the fields that record the time of work. Though this is stored in the database as a single field for start of shift and single field for end of shift, in the entry it is split up into 9 fields: 3 for day, month, and year, and three more each for start hours, start minutes, AM/PM, end hours, end minutes, and AM/PM, which I then concatenate to get the dates to store. The update part works fine. When I go in to display each of these, I have to use an SQL query to retrieve only that section of the time.
    The problem I am having is that if the user pulls up several timecards to edit them, it retains these time values from the previous timecard, and due to the way the collections refresh, I can't seem to get either item session state parameter (Only when Null/Always from Source) to achieve the desired result. If I use the Only When Null option, I retain the values from the previous timecard. If I use the Always from Source, the user can't update any of the time-related input.
    Can anyone suggest a solution? I've tried a session state process that fires on entry to clear those items and ran into the same problem as using the Always From Source option. There has got to be a way to handle this, but it's got me stumped and my users are clamoring for a fix.
    Page initial load
    A. Before Header process populates job collection and other collection (not header info), which comes straight from DB table.
    B. Data displays for Header (from table) and two detail sections (from collections)
    User presses Submit to save changes
    1. On Submit Before Processing: updates job and other collections (to preserve changes in case validation fails)
    2. Validations check to make sure job codes are valid, date is valid, employee is valid, etc.
    3. On Submit After Processing: Writes changes to header from input form, writes changes to job and other from collections to appropriate DB tables
    I also have two On Submit After Processing processes to add blank lines - one for each collection. These are triggered via buttons.

    Blair:
    Does creating a 'before header' process to populate these fields make a difference ? The sql could be something like
    select TO_CHAR(TC_START_TIME,'HH') into :P1115_TIME_IN_HH from TC where TC_ID = :P1115_TC_ID;You should set the 'Source Used' back to 'Only when current value in session is null' and the 'Source Type' to 'Static Assignment(....)' and clear out the 'Source value or expression' field.
    varad

  • I need help with looping a java file

    I am wondering is it possable to loop a java file. By this i mean re-run it again from a particular point in the program. Like where i have marked out below.
    import java.util.*;
    public class Player
    public static void main(String[] args){
    Songs listing = new Songs();
    Player gui = new Player();
    listing.readarray();
    // I would like to loop it here once the option has been selected.
    Scanner myScanner = new Scanner(System.in);
    int option1;
    System.out.println("--------Options-------");
    System.out.println(" ");
    System.out.println("Type Option Number ");
    System.out.println(" ");
    System.out.println("1 :View Songs");
    System.out.println("2 :View Playlist");
    System.out.println("3 :Edit Playlist");
    System.out.println("4 :Play Playlist");
    System.out.println(" ");
    System.out.println("What option would you like?");
    option1 = myScanner.nextInt();
    if (option1 == 1)
    listing.disparray();

    import java.util.*;
    public class Player
    public static void main(String[] args){
    Songs listing = new Songs();
    Player gui = new Player();
    listing.readarray();
    *while (true)*
    // I would like to loop it here once the option has been selected.
    Scanner myScanner = new Scanner(System.in);
    int option1;
    System.out.println("--------Options-------");
    System.out.println(" ");
    System.out.println("Type Option Number ");
    System.out.println(" ");
    System.out.println("1 :View Songs");
    System.out.println("2 :View Playlist");
    System.out.println("3 :Edit Playlist");
    System.out.println("4 :Play Playlist");
    System.out.println(" ");
    System.out.println("What option would you like?");
    option1 = myScanner.nextInt();
    if (option1 == 1)
    listing.disparray();
    }}

Maybe you are looking for