How do i get input from the user?

For example if i wanted to ask "Whats your favorite number" and then get the input from the user and assign it to a variable how would i go about doing that?

hi,
if you want to get input from your console your should work with io(input and output).The BufferedReader class, InputStreamReader class
you should import "java.io.BufferedReader" and "java.io.InputStreamReader" package, and do something like this:
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String favoriteNumber;
System.out.println("Whats your favorite number ");
favoriteNumber = input.readLine();
System.out.println ("Your favorite Number Is " + favoriteNumber);
if its a gui you should import "javax.swing.JOptionPane" and do the following
String favoriteNumber = JOptionPane.showInputDialog(null, "Enter your favorite Number", "Favorite Number", JOptionPane.INFORMATION_MESSAGE);
anjiie([email protected]).

Similar Messages

  • How to execute BAPIs by getting the input from the user through the browser

    Hi,
    I have created a simple xMII transaction using BAPI. It is a simple BAPI with one input. Now i want the transaction to be executed by getting the input from the user through browser. Once the user enters the value and clicks on a button, I want the result of the BAPI to be displayed in the grid. How to link the BAPI/transaction with applet/Javascript coding.
    Thanks.

    The first thing I would recommend would be for you to collaborate with your colleague Vinodh, since his/her recent thread is very similar to yours:  Calling a BAPI from web page
    In your case, the iGrid applet will run the Xacue query template and automatically display the results from your output parameter.
    I would encourage you to take a look at the sticky thread at the top of the forum entitled "MII Manufacturing Templates Updated" since this MII project is full of samples for you and your colleague to learn from.

  • How can i get input from user in Workflows

    Hello professionals,
    I'm new to SAP B1 Workflow, i have created some workflows and they all worked fine.
    But, I am wondering, How can i get input from user?. For example, i want to display list of options to choose between them and route the workflow based on the selected option. I don't want to use the exclusive gateway and check for some conditions, i want to get input from user.
    How can i do that?
    Thanks in advance,
    Kareem Naguib

    Hi,
    Please refer SAP help file:
    http://help.sap.com/saphelp_sbo900/helpdata/en/b8/1f9a1197214254b79bcf8f93f9fff9/content.htm?frameset=/en/44/c4c1cd7ca22…
    Thanks & Regards,
    Nagarajan

  • How do i get input from user?

    For example if i wanted to ask "Whats your favorite number" and then get the input from the user and assign it to a variable how would i go about doing that?
    Any help would appreciated

    hope this helps
    import java.io.*;
    public static void main(String[] args)
      //this is the important part
      BufferedReader in = new BufferedReader( new InputStreamReader(System.in) );
      String response = "";
      System.out.println("What is your favorite color?");
      try{
           //now read the line
           response = in.readLine();
      }catch(Exception e){
            //enter error code here
      System.out.println("I like " +response+ " as well!");
    }

  • How can I get Data from the Sound cart in Labview? Does a VI exist?

    How can I get Data from the Sound cart in Labview? Does a VI exist?

    Yes, there are VIs for acquiring data from Sound cards. And examples too. If you don't have LabVIEW yet, do a search on NI's site for example VIs.
    Khalid

  • How do I get photos from the iPhoto import folder to the iPhoto library?  It uploaded, but hung while deleting from my camera, so no imported photos are in the iPhoto library.

    How do I get photos from the iPhoto import folder to the iPhoto library?  It uploaded, but hung while deleting from my camera, so no imported photos are in the iPhoto library.  I watched it upload about 400 photos, one by one.  They're somewhere, but they don't appear in the iPhoto library. As iPhoto was deleting them from my camera, it got hung up, then a message came "you should eject before disconnecting a device."  I hadn't touched the camera.  The message came by itself.  I couldn't get iPhoto to respond, so I disconnected the camera and did a Force Quit.  Opening it back up, the pictures were gone.  Can somebody help me? 

    What version of iPhoto are you running?  Assuming it's iPhoto 9 or later Apply the two fixes below in order as needed:
    Fix #1
    1 - launch iPhoto with the Command+Option keys held down and rebuild the library.
    2 - run Option #4 to rebuild the database.
    Fix #2
    Using iPhoto Library Manager  to Rebuild Your iPhoto Library
    1 - download iPhoto Library Manager and launch.
    2 - click on the Add Library button and select the library you want to add in the selection window..
    3 - Now that the library is listed in the left hand pane of iPLM, click on your library and go to the Library ➙ Rebuild Library menu option.
    4 - In the next  window name the new library and select the location you want it to be placed.
    5 - Click on the Create button.
    Note: This creates a new library based on the LIbraryData.xml file in the library and will recover Events, Albums, keywords, titles and comments but not books, calendars or slideshows. The original library will be left untouched for further attempts at fixing the problem or in case the rebuilt library is not satisfactory.
    OT

  • Plz tell me how I can get back from the recovery mode to my normal mode without lossing data ... actually I was trying to update ios 7 in my 4s so then mobile stuck into recovery mode...plz help?

    plz tell me how I can get back from the recovery mode to my normal mode without lossining data...I stuck in this mode while I was try to update ios 7 in my 4s

    If it's in recovery mode, anything on the phone is already gone.  Restore the phone using iTunes, then restore it from your last backup. If you've been backing up on a regular basis as intended, you won't lose anything except what's changed since the last backup.

  • I just just got the new IPhone 5.  How do I get everything from "The Cloud" onto my new IPhone?  I have a LOT of complete music albums I purchased from ITunes

    I just just got the new IPhone 5.  How do I get everything from "The Cloud" onto my new IPhone?  I have a LOT of complete music albums I purchased from ITunes
    And would very much like to retrieve it. Help please & thank you everyone

    Transferring from old to new
    http://support.apple.com/kb/HT2109

  • How to get data from the user for an Insert Trigger ?

    Hi all and thanks in advance, I need to get some values from the user for a child table when a row inserted into the parent table, is that possible to use ampersand inside an "Insert Trigger" to let the user for inserting some values ?
    Edited by: user9942078 on 17-Dec-2008 16:35

    In a different words,
    When a virus attacked your body your blood cells instantly goes into operation. Just like that -> your trigger activated as a result of your DB operation on objects. So, here also you have no option to manually intervene anything.
    Hmm... Looks like some science fiction movies ultimately pays some price... ;)
    So, trigger basically fires implicitly as a result of any database operation on objects or even on user.
    So, that has to be automatic. And, when you are using & it will ask for some input value - which cannot be done in case of triggers.
    For details please refer the oracle docs.
    Regards.
    Satyaki De.

  • How do i get something from the Input ( Keyboard ) - NOT an Applet

    something simple for u guys...im nea @ this...so which methods do i need to get something from the keyboard...i mean..console waits for you to write a line ( a String ) and after pressing Enter the program puts it in another String in my code...
    hope u get what im talking about...sorry for the bad english...thnx a lot!!!! :)

    this class has how to get from a file or from a String in your code but cant find something like get the String from the console ( like u do in C language ).
    here is the scan class : here

  • HT4859 My phone was stolen.  I synced with my computer and lost some pictures that are backed up on the cloud.  How do I get pics from the cloud that are not in my photostream?

    My phone was stolen.  I first backe up from the icloud but then synced with my computer and lost some pictures that are backed up on the cloud.  How do I get pics from my old phone which are backed up on the cloud but are not in my photostream?

    If you have an iCloud backup, restore it to your phone as explained here: https://support.apple.com/kb/ph12521.  If you have a backup on your computer instead, restore it to your phone by connecting your phone to your computer, opening iTunes and going to File>Devices>Restore from Backup.

  • HT1879 how do i get music from the itunes store to my ipod

    How do i download music from the itunes store to the ipod shuffle. New computer and i dont have the software for the shuffle.

    Download to iTunes, then sync your device with iTunes.

  • Event.rc and Restriction of inputs from the User...

    Im using Adobe Professional Live cycle designer 7.0 to design pdf form. Also, Im using an existing pdf (supplied by the customer), which is designed through teleform designer (with adobe 6.0) model for this design. In the existing one, the javascript methods are working fine for restricting keys, validation, etc. But these scripts are not working in designer as the designer is using XFA model.
    Im trying to restrict the key inputs (like only numbers/characters should be entered). But I couldnt find the equivalent statements for some of the statements (which are used in the teleform pdf).
    For eg.
    event.rc = true. Allows keystroke to be added to entry. event.rc = false. Prevents keystroke being added to entry in the following function:
    function TFTemplate_KeyStroke( mask )
    if (event.willCommit) {
    return;
    var value = AFMergeChange( event );
    if (!mask.test( value )) {
    event.rc = false;
    app.beep( 0 );
    But I couldnt find the matching statements in Designer for event.willCommit, AFMergeChange(),event.rc, etc.
    If I get, I can restrict the inputs.
    Expecting any solutions from you...
    Thanks in Advance...

    Hi,
    Based on your description, I understand that you want to use application or some functional tools and then
    monitor the user printer job. When be greater than a certain number, it will need to acquire additional information. As I know, it seems that there is no such function can meet your requirement. Sorry for it.
    In addition, I find that you use a third-party software for this functionality before. Please check and confirm
    if you can get a new version (or some updates, service package) that may help it to be supported in Windows Server 2012.
    Hope this helps.
    Best regards,
    Justin Gu

  • Help with getting input from the console

    Hey Experts , wish you are good ? .... i have a problem and wish you figure it out for me , well tell me how can store the input values in a text file and pass the file from the command line ? , i have compiled the program so well , but i could not using text file , thats the code :
    import java.util.Scanner ;
    class TestScanner {
    public static void main (String[] args) {
    Scanner scanner = new Scanner(System.in);
    System.out.print("Enter an interger : ");
    int intValue = scanner.nextInt();
    System.out.println(" You entered an interger " + intValue);
    System.out.print("Enter a double value : ");
    double doubleValue = scanner.nextDouble();
    System.out.println("You entered a double value " + doubleValue);
    System.out.print("Enter a string without space: ");
    String string = scanner.next();
    System.out.println("You entered the string " + string);
    }and i created a file with value like that :
    file name is input
    5
    23.55
    Java
    true
    i just want to know the correct order to compile it .
    thanks in advance

    The Java Tutorials: [_Basic I/O_|http://java.sun.com/docs/books/tutorial/essential/io/index.html]
    db

  • How do I get downloads from the internet to open in something other then text edit?, How do I get downloads from the internet to open in something other then text edit?

    Lots of times when I download files from the internet like games or something they will open up in text edit.  When it comes up its just a bunch of letters and numbers, it won't actually run the application.  How do I get the file to open up correctly and actually run?

    Hi, do you have a link to one of these you downloaded that does this?
    Basically you, in the Finder, do a Get Info on it, look for Open With & choose the proper application, but might these be Windows® only games?

Maybe you are looking for

  • Airplay from PGATOUR app, audio garbled

    I was trying to airplay the PGATOUR video from the app for iPad (I have a new IPad, 16GB, WiFi + 4G), and the video played nicely but the audio was garbled.  Sounded like it was coming acorss on a tin can on a string.  The video and audio both played

  • How do I stop the pop up blocker from blocking popups? I have already disabled it.

    how can I stop the popup blocker from blocking popups? I have disabled it but they are still being blocked. == This happened == Every time Firefox opened

  • Install Java Add-In for existing ABAP == 'First MSCS Node' step fails

    I am in the process of installing the Java Add-In for an existing ABAP System. I am doing the High-Availability Installation Services. There are seven (7) steps: 1. Central Services Instance (CSC) Java Add-In 2. First MSCS Node 3. Database Instance J

  • HT4623 can i instal ios 7 in ipad 1?

    can i instal ios 7 in ipad 1 ?

  • SQL*NET V2 SETUP (MTS)

    제품 : SQL*NET 작성날짜 : 1997-06-23 SQL*NET V2 SETUP (MTS) ====================== UNIX에서 SQL*NET V2를 사용하려면 ORACLE 인스톨 후에 다음과 같이 SETUP을 한 다음 사용하면 된다. 여기서 ORACLE_HOME DIRECTORY는 /usr/oracle7 ORACLE_SID는 ORA7 이라고 가정한다. 1. (단, MTS로 setting하지 않고 dedicated로 접속할