How to specify user input?

I know how to use the Keyboard class to prompt user input, but if I want to create custom user arrays, can anyone help me go about how to do it?
I want the user to be able to specify an array between 100 and 200 characters ins ize, and I'd create an array like that according to the user input...I don't have a clue how I'd even begin this though...Please help.

If I understand correctly: take user input as an int and create an array of that size? if so:
int size = parseInt( args[0] );
ObjectName nameOfArray[] = new ObjectName[size];
args is (almost) always a string array so you need to extract the int value (parse it). that simple :)

Similar Messages

  • How to get User input in JTextField?

    How to get User input in JTextField? Can u anyone give me some code samples? thanks

    read the API!!!

  • How to take user input and place it in a variable

    All I want to know is how to copy user input from the message pop up and store in a local variable?
    Thanks.

    Hi
    Just take a look at thread's example
    http://forums.ni.com/t5/NI-TestStand/TestStand-Message-Popup/m-p/1792424/highlight/true#M35397
    The trick is done by Message-Popup PostExpression: Locals.strMyResponse = Step.Result.Response
    Hope this helps
    Juergen
    =s=i=g=n=a=t=u=r=e= Click on the Star and see what happens :-) =s=i=g=n=a=t=u=r=e=

  • How to get user input to keep in array in the form of int[]?

    I really want to know how to get user input to keep in an array. Or if it's impossible, can i use the value in "int" and transfer it to an array?

    What I understand is that you want to set an input from the user in an array of int.
    Here is how it work:
    1. Create a stream and a buffer to get and store the informations entered by the user:
    BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
    2. Set this input in a String:
    String input = stdin.readLine();
    3. Set this string in an int:
    int userInput = Integer.parseInt(input);
    4. Then you can put this int in the array.
    Warning this code throws IOExceptions and NumberFormatException ( when you try to set letters as int ). But you can catch them easily.

  • How to capture user input for customer exit processing?

    I need to calculate the number of working days elapsed in the current fiscal quarter BASED on the USER INPUT on the reporting front.  i.e., say the fiscal quarter started on 1 July 2005 and if the user enters 10 July 2005, I should get the value 8 (Assume that Monday through Friday are all workdays).  If the user enters 12 July 2005, I should get 10.  I have written customer exits and know how to use factory calendar, but <b>THE CHALLENGE</b> is how do I <b>CAPTURE</b> the user input and use it in my exit?  During the varible definition, if I select the check box "Ready for input" then the customer exit is not being processed and unless I check that box I can't get a user entry!  If I look at the import values in the customer exit, I see i_t_var_range with type rrs0_t_var_range.  My strong feeling is that this parameter gets the user input, but I am unable to use it as the customer exit is not being called if I make the user to input the data.  Based on the empirical evidence, I felt that user input and customer exit can not co-exist!!  Please somebody prove me wrong and let me know how can I use the user input to process my "customer-exit" variable.  I would really appreciate any input from the BW community here.

    Hi Sameer,
    Most likely, I'm missing something, but I think that the answer is very simple.
    CASE I_VNAM.
    WHEN 'YOUR_CUSTOMER_EXIT_VAR'.
    IF I_STEP = 2. “ After selecting of input variable
    LOOP AT I_T_VAR_RANGE INTO LOC_VAR_RANGE
    WHERE VNAM = 'USER_INPUT_VAR'.
    CLEAR L_S_RANGE.
    L_S_RANGE-LOW = LOC_VAR_RANGE-LOW(4).
    APPEND L_S_RANGE TO E_T_RANGE.
    ENDLOOP.
    ENDIF.
    ENDCASE.
    In this typical user exit coding you have a user entered value in LOC_VAR_RANGE (originally in I_T_VAR_RANGE) and you construct your user exit variable value in E_T_RANGE.
    Best regards,
    Eugene
    Message was edited by: Eugene Khusainov

  • How to accept user inputs from  sql script

    I want to create Tablespace useing sql script , but the location of the data file I need accept from user . (to get the location of the data file ) .
    How can I accept user input from pl/sql .
    Example :
      CREATE TABLESPACE  TSPACE_INDIA LOGGING
         DATAFILE 'H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf'
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
         EXTENT MANAGEMENT LOCAL;here I need to accept location of the datafile from user ie : 'H:\ORACLE_DATA\FRSDB\TSPACE_INDI_D1_01.dbf'

    Hi,
    Whenenever you write dynamic SQL, put the SQL text into a variable. During development, display the variable instead of executing it. If it looks okay, then you can try executing it in addition to displaying it. When you're finished testing, then you can comment out or delete the display.
    For example:
    SET     SERVEROUTPUT     ON
    DECLARE
        flocation     VARCHAR2 (300);
        sql_txt     VARCHAR2 (1000);
    BEGIN
        SELECT  '&Enter_The_Path'
        INTO    flocation
        FROM    dual;
        sql_txt :=  'CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
         DATAFILE' || flocation || ' "\SRC_TSPACE_INDI_D1_01.dbf" ' || '
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
         EXTENT MANAGEMENT LOCAL ';
        dbms_output.put_line (sql_txt || ' = sql_txt');
    --  EXECUTE IMMEDIATE sql_txt;
    END;
    /When you run it, you'll see something like this:
    Enter value for enter_the_path: c:\d\fubar
    old   5:     SELECT  '&Enter_The_Path'
    new   5:     SELECT  'c:\d\fubar'
    CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
         DATAFILEc:\d\fubar
    "\SRC_TSPACE_INDI_D1_01.dbf"
         SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE
    UNLIMITED
         EXTENT MANAGEMENT LOCAL  = sql_txt
    PL/SQL procedure successfully completed.This makes it easy to see that you're missing a space after the keyword DATAFILE. There are other errrors, too. For example, the path name has to be inside the quotes with the file name, without a line-feed between them, and the quotes should be single-quotes, not double-quotes.
    Is there some reason why you're using PL/SQL? In SQL, you can just say:
    CREATE TABLESPACE SRC_TSPACE_INDIA LOGGING
    DATAFILE  '&Enter_The_Path\SRC_TSPACE_INDI_D1_01.dbf'
    SIZE 500M  AUTOEXTEND ON NEXT  1280K MAXSIZE UNLIMITED
    EXTENT MANAGEMENT LOCAL;though I would use an ACCEPT command to given a better prompt.
    Given that you want to use PL/SQL, you could assign the value above to sql_txt. If you need a separate PL/SQL variable for flocation, then you can assign it without using dual, for example:
    DECLARE
        flocation     VARCHAR2 (300)     := '&Enter_The_Path';The dual table isn't needed very much in PL/SQL.
    Edited by: Frank Kulash on Jan 10, 2013 6:56 AM

  • How to give user input in flsh animation??

    i m a student of engineering and my project is to create animation of dc motors whose parameters can be controlled by user input
    means current,voltage and speed of the rotor...how con i do it...
    m totally new iin this field and learning flash...
    and can i make these type of animation in flash professional CS5???

    What you should probably consider is using Slider components to control each of the parameters.  There should be examples of how to use them in the help documentation.

  • How to save User input into DB using webdynpro abap

    Hi,
    Im trying to create an application using webdynpro abap.
    I want to know how to save the data input by user, into a database table.
    In my UI, I have a table control which is editable and user inputs data into this. I need to know how i can transfer this data to a DB table.

    hello,
    u can do it by reading ur context node.
    we bind our UI elements to context attributes of appropriate type .
    we read their values using the code wizard or by pressing control+F7, click on radio button read node/attribute
    here for ur specific case , u must have binded ur table control with the context attribute , now u need to simply read this attribute
    eg suppose u have created a context node " cn_table"
      reading context node cn_table
       DATA : lo_nd_cn_table TYPE REF TO if_wd_context_node ,
             lo_el_cn_table TYPE REF TO if_wd_context_element ,
             ls_cn_table    TYPE wd_this->element_cn_table.
    *   navigate from <CONTEXT> to <CN_TABLE> via lead selection
      lo_nd_cn_table = wd_context->get_child_node(
                       name = wd_this->wdctx_cn_table ).
    **    get element via lead selection
      lo_el_cn_table = lo_nd_cn_table->get_lead_selection(  ).
      lo_el_cn_table->get_static_attributes( IMPORTING
                 static_attributes = wa_table ).
    here wa_table is the work area of structure type . u need to create a structure first with the same variables as there are the context attributes in ur node cn_table
    in ur
    now ur wa_tablecontains value
    u can nw use appropriate FM to update , delete and modify the DB table using the value
    u cn directly use SQL statements as well in the method of ur view , but direct SQL statements are nt recommende
    rgds,
    amit

  • How to control user input with a button?

    How do I control a user input from a dialog box by activating it with a button. I am saying "press zero", then when the user does press zero, it should zero the scale.

    The user has only one button they can press.  You should enable the cancel so that the dialog can output an F.  
    What you have works, but the zero will not occur until the case is activated.  If the insides of the case do not work, that is another story.  Put a pop up in the active case to convince yourself that the case is being entered.
    This, what you have, always returns T.
    Mark Ramsdale

  • How to compare user input and database data?

    hi, I am new to JAVA, i hope i didnt post wrong forum :P
    I would like to know how to get user data input from web page(client side) and compare with the data in database (server side)?
    What i doiong is using the JavaScript to get the user input and compare with the JSP. but this way it seem like not a good way! Because i facing a lot of problem to get the user input!!
    Thx a lot!!
    function pasteData(obj){
              var em_num_select = obj;
         //document.write(em_num_select);
              <%
                SQLSelectNO = "SELECT em_num FROM emmast ";
                   try {
                        getEmpNo = db.execSQL(SQLSelectNO);
                   }catch(SQLException e){
                        System.err.println("Query Error!!");
                   while(getEmpNo.next()){
                        matchEmpNo = getEmpNo.getString("em_num");
                        %>if (em_num_select == '<%=matchEmpNo%>'){
                        <%
                                  String SQLgetAllInfo = "SELECT em_num, em_name, em_init, "+
                                                                                         "em_buyer_flag, em_dsgn_cde, em_proj_all, "+
                                                                                         "em_proj_cde1, em_proj_cde2, em_proj_cde3 "+
                                                                                         "FROM emmast "+
                                                                                         "WHERE em_num = '"+matchEmpNo+"' ";
                                  try{
                                       getAllInfo = db.execSQL(SQLgetAllInfo);
                                  }catch(SQLException e){
                                       System.err.println("Query Error");
                                  while(getAllInfo.next()){%>
                                       document.all.emp_name.value = '<%=getAllInfo.getString("em_num")%>'
                                       document.all.emp_init.value = '<%=getAllInfo.getString("em_name")%>'
                                       document.all.emp_disg.value = '<%=getAllInfo.getString("em_dsgn_cde")%>'
                                       document.all.emp_buyer_flg.value = "<%=getAllInfo.getString("em_buyer_flag")%>";
                                       document.all.emp_basis.value = "<%=getAllInfo.getString("em_proj_all")%>";<%System.out.println(getAllInfo.getString("em_proj_cde1"));%>
                                       document.all.emp_pro_cde1.value = "<%=getAllInfo.getString("em_proj_cde1")%>";
                                       document.all.emp_pro_cde2.value = "<%=getAllInfo.getString("em_proj_cde2")%>";
                                       document.all.emp_pro_cde3.value = "<%=getAllInfo.getString("em_proj_cde3")%>";
                             <%}%>
                             }//close if (em_num_select == '<%=matchEmpNo%>')
              <%}// close hile(getEmpNo.next())%>
         }// close function pasteData(obj)

    Hi,
    This forum is exclusively for Sun Java Studio Creator.
    You may need to post this question at:
    http://forum.java.sun.com/forum.jspa?forumID=45
    Thanks,
    Creator Team.

  • How to add User Inputs?

    Well I'm new to Java, and I was trying to make a basic calculator to add 2 user inputs and give a total. Here is my code:
    import java.util.Scanner;
    public class calculator {
         public static void main(String[] args) {
              int total;
              Scanner number1 = new Scanner(System.in);
              Scanner number2 = new Scanner(System.in);
              System.out.print("Enter your first number: ");
              System.out.println(number1.nextLine());
              System.out.print("Enter your second number: ");
              System.out.println(number2.nextLine());
              total = number1 + number2;
              System.out.print("Your total is: " + total);
    }And here is my error:
    C:\Users\Jennifer\Desktop\Vincent's Things>javac calculator.java
    calculator.java:13: operator + cannot be applied to java.util.Scanner,java.util.
    Scanner
                    total = number1 + number2;
                                    ^
    1 errorI tried giving it a cast, since it's saying Scanner's can't be operated, such as:
              total = (int)number1 + (int)number2;But that didn't work. How can I make it so it adds the two inputs?

    A Scanner is a Scanner. Of course you can't just add two Scanners together. The Scanner could also be used to read text. A Scanner can't read your mind to know what type of data you are reading. You have to tell the Scanner what type of data you are reading. They way you do that is to read the Scanner API and use the proper methods.

  • How to pass user input in automator to a variable?

    I want to ceate a workflow/application to
    -create a new folder eg Batch001 in directory B
    -grab a group of folders in directory A
    -and move them to Batch001
    -create an archive of Batch001
    -create a new set of empty folders in directory A
    I thought I had this worked out, and planned to create a small applescript to grab a user input, then pass it to a variable. Figured if I do that at the beginning I can use the variable to create the Batch folder name, which I would enter manually. There will be a number of them, but not hundreds.
    I have an applescript in automator to show a dialog, but ti does not seem to pass anything to the results. Even if I just use a simple dialog no results are passed. If I run it in actionscript editor it shows a result as expected.
    on run {input, parameters}
      --Display Dialog and Get Input
      display dialog "Batch Number?" default answer "BatchXXX"
      --Get Answer & Return Comment
      set input to (text returned of result)
      return input
    end run

    I tried that, but when I run my workflow, it fails and I get an error message: The action “Rename Finder Items” encountered an error.
    Here are a couple of screenshots of my workflow:

  • How to validate user input

    Hi,
    I am new to Form design
    I am designing an offline form I just want to validate the user input
    whether user has entered Character or Numric.
    if user enters characters in phone no I have to give an error message.
    can you please give the pice of the script to validate the user input.
    Regards
    Bikas

    Instead of finding what is the type of input, you can restrict the user not to type characters in Phone No field.
    Place the below code in Change event of the Phone No field with Java Script as language. 
    // restrict entry to digits
    if (xfa.event.change.match(/[0-9]/) == null)
         xfa.event.change = "";
    Note: You have placed the question in the wrong forum.. You might need the Designer ES forum.
    Thanks
    Srini

  • How to validate user input field?

    I need to validate a user input field against a table. This field is not part of an EO but is used to update an attribute on an existing EO.
    My question is, where would I place the sql that would validate the user input value against the table?
    Is there an easy way to do this?
    I'm at a roadblock and really need some help. Thank you.

    You can execute a sql query or a function from <your>AMImpl.java, using normal jdbc.
    but I would recommend this, it is easier and cleaner approach
    1. Create a VO (<your>VO) with the sql statement
    Select client
    from client_table
    where resp_id = :1
    and client= :2
    2. Add this vo to the am
    3. In AMImpl, get handle to the VO (this.get<your>VO1)
    4. Bind params
    this.get<your>VO1().setWhereClauseParams(0,current_resp );
    this.get<your>VO1().setWhereClauseParams(1,user_input_value);
    5. Execute the query
    this.get<your>VO1().executeQuery();
    6. Get the row after the query is executed
    oracle.jbo.Row <your>Row = this.get<your>VO1().first();
    7. Get the value of the attribute from the row
    l_client = <your>Row.getAttribute("Client") ;
    8. So now you have what you wanted to do with the sql.
    Thanks
    Tapash

  • How to Reread user inputs after detecting they're invalid

    I was wondering if there was a way to redetect/reread user inputs once the original values were detected to be invalid? If I place everything in a continuous loop, i've tried manually pausing the vi. When I unpause the vi, it does reread the inputs. Any ideas would be appreciated. Thanks!

    If the terminals were within a sequence within the loop, they still would have been read on every loop iteration, but maybe after you needed the updated value. Unless you had them in a case and the case wasn't selected on the loop iteration. There could have been several ways in which your program was structured so you wouldn't see the updated values when you needed them, but there was more to it than just having the terminals in the sequence. Just be careful that you have good control over when the updated values are read (e.g. using dataflow control) in relation to everything else happening in your loop.

Maybe you are looking for