Inputting from the keyboard

hi everyone, can anyone help me on how to read what the user inputs from the keyboard when running a program in command-line(ms-dos prompt)interface.Does it have something to do with System.in any help would be appreciated.
(Example)
System.out.println("Please enter your name ");
String name = //capture the name in string
System.out.println("Enter your choice");
int choice = //capture what the choice is
System.out.println("your choice is "+ choice);
}

Modified version of example code in working test file.
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
//Class
public class KeyBoardInput
  //data members declared static
  static BufferedReader buff = new BufferedReader(
  new InputStreamReader ( System.in) );
  static String buffin; 
  //main method
  public static void main ( String[] args )
    int test = readInt("enter a number");
    System.out.println("you have entered " + test );
  //reads strings and converts to integers
  public static int readInt( String prompt )
        try
     System.out.println(prompt);
        buffin = buff.readLine();
        buff.close();
     catch (IOException IoE) {}
        return Integer.parseInt ( buffin );
  //needs work
  public static String readString( String prompt )
     //?? need to work on this one
}

Similar Messages

  • Can anyone explain to me why sometimes my ipad2 locks up and won't respond to any input from the keyboard.

    My iPad 2 locks up sometimes and won't respond to any input from the keyboard. Have to reboot in order to fix the problem.

    You have 3 choices:
    1. Do a reset (Hold Sleep/Wake and Home buttons about 10 secs or more till Apple logo appears, ignore the Slide to Power Off that appears)
    Note: You will not lose any data.
    2. Restore from backup using iTunes
    3. Restore as new without the backup

  • Just installed an Epson stylus SX435w. But the usb cable prevents input from my keyboard ?

    Just installed an Epson stylus SX435w. But the usb cable prevents input from my keyboard ?  When I remove the printer usb, and then remove and re-insert the keyboard usb my keyboard works again. Any thoughts on what is causing the problem?

    Keyboards  and mice are low power devices.  Put your printer on a separate USB port from the keyboard and mouse.  If you have to, buy a wall powered USB hub to have multiple USB devices on your Mac.

  • How to take Input from the callers telephone keypad into oracle database

    My client requires to automate a registration task for his customers by telephone. The requirement is the Oracle database should take numeric input from the callers telephone keypad eg 1 or 2 or 3 and the oracle must store this input inside its database and do some required processing with such input and generate a unique numeric id (sequence) and send back this unique numeric ID to the caller who is on hold. Please Note. Is there any electronic device to be installed at the client site to solve the above task eg. any telephone line to be connected to the CPU and etc?
    I completely have zero knowledge. Please can you outline/summarise the instructions how to construct and install to meet my client requirement.
    If this is not possible in Oracle I Can migrate to any database. Please suggest.
    please help me. if you cant help i appretiate if you give me some clues

    You need to start with your telephone system. Normally this situation would involve some sort of PBX or other internal switching equipment. Talk to your vendor. There's likely to be software, etc. available to perform the interaction with the end user.
    It should have programmable "hooks" to interface with various databases. To Oracle it just looks like another program.
    Ken

  • I have a macbook and when I power it on and then select myself as a user...It won't power up. It stays in the white screen with the apple logo. I am online currently under 'guest user'. Is there anything I can do from the keyboard to fix this??? Help!!!

    I have a macbook and when I power it on and then select myself as a user...It won't power up. It stays in the white screen with the apple logo. I am online currently under 'guest user'. Is there anything I can do from the keyboard to fix this??? Help!!!

    Could you specify the model of MacBook and the OS X it's running, please? Some of the advice or references vary along with the system, so this could be helpful to formulate a reply. I've never used a Guest User selection, but do have more than one User.
    If the computer does not have an optical drive, you may be able to boot it into a recovery disk mode or something; in an attempt to see what is wrong and maybe fix it.
    Good luck & happy computing!

  • In Mail 7.3 on my Retina MacBook Pro on OS 10.9.4, how can I type from the keyboard into a mail message using the Apple Symbols font?

    In Mail 7.3 on my Retina MacBook Pro on OS 10.9.4, how can I type from the keyboard into a mail message using the Apple Symbols font?
    When I select the Apple Symbols font from the list accessed from under Format/"Show fonts"/collection-all fonts/Apple Symbol, and then continue typing, I get normal letters, if in a slightly different font.
    How can I type using the Apple Symbol font?  I want to use that font to include keyboard and cursor selections of actual screen symbols to help write easily understood explicit computer lesson emails to my 92 year-old mom from a few hundred miles away.
    Steve

    In Mail 7.3 on my Retina MacBook Pro on OS 10.9.4, how can I type from the keyboard into a mail message using the Apple Symbols font?
    When I select the Apple Symbols font from the list accessed from under Format/"Show fonts"/collection-all fonts/Apple Symbol, and then continue typing, I get normal letters, if in a slightly different font.
    How can I type using the Apple Symbol font?  I want to use that font to include keyboard and cursor selections of actual screen symbols to help write easily understood explicit computer lesson emails to my 92 year-old mom from a few hundred miles away.
    Steve

  • 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]).

  • 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.

  • Is it possible to have 5.1 S/PDIF input from the pins of Audigy 2 ZS SB0350?

    LIs it possible to have 5. S/PDIF input from the pins of Audigy 2 ZS SB0350? Hello,
    I took this sound card (Audigy 2 ZS SB0350) yesterday from a friend, just to test whether it can do what I intend to use it for. It is only the card itself without the front panel (the I/O Dri've Bay) and I want to connect a satellite receiver's S/PDIF output to the sound card input in order to experience a 5. sound, which my satellite receiver supports. Since it turned out that this sound card has no digital inputs but on the front panel (the I/O Dri've Bay), I started wondering whether I can connect the coaxial digital out of the satellite receiver directly to some of the pins of the Audigy 2 ZS, and in case I can do that, will I have the desired 5. sound on the analogue outputs of the sound card or just stereo?
    If this is impossible, can you confirm that if I buy Audigy 2 Platinum (with I/O Dri've front panel) I can have the desired effect (no matter if the output of the satellite receiver is coaxial or optical)?
    Thank you for your answer
    Best regards,
    Zdravko

    Install disks for specific systems do not boot a different system.  Sometimes if the two computers are from the same year and are the same type and the same build number, maybe.

  • In the address bar where type the address of the web site at the top. after entering the address i press enter key from the keyboard but it does'nt work there . Means the page is not navigating towards the address. Kindly solve the problem

    In the address bar where type the address of the web site at the top. after entering the address i press enter key from the keyboard but it doesn't work there . Means the page is not navigating towards the address. Kindly solve the problem

    This issue can be caused by an extension that isn't working properly.
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    * Don't make any changes on the Safe mode start window.
    * https://support.mozilla.com/kb/Safe+Mode
    * [[Troubleshooting extensions and themes]]
    In Firefox 4 you can use one of these to start in <u>[[Safe mode]]</u>:
    * Help > Restart with Add-ons Disabled
    * Hold down the Shift key while double clicking the Firefox desktop shortcut (Windows)

  • Add Keyword from the Keyboard

    When “keyword controls” is active on the control bar I’m able to type an already defined keyword in the “Add Keyword” box and it appears and can be easily added to the selected image by pressing enter. Then I often want to go back to the browser to select another image, so I press “tab” which takes me to the browser.
    So far so good.
    Now I would like to get back to the “Add Keyword” box without leaving the keyboard, meaning without having to go to the mouse to click in the “Add Keyword” box.
    Is there a way to do this from the keyboard?
    Ken

    Awesome, Thanks.

  • How to demote to body from the keyboard in outline form?

    How to demote to body from the keyboard in outline form?

    This is the method i am using to populate a list.
    1- First of all you need to create a non-database list item for customer_name.
    2-create this procedure
    PROCEDURE populate_list_with_query
    --Populates the given list item with the specified query.
    (p_list_item in VARCHAR2
    ,p_query in VARCHAR2)
    IS
    /* Name the record group after the list item (no
    block prefix). */
    cst_rg_name constant VARCHAR2(30) :=
    GET_ITEM_PROPERTY(p_list_item,item_name);
    v_rg_id RECORDGROUP;
    BEGIN
    v_rg_id := FIND_GROUP(cst_rg_name);
    IF ID_NULL(v_rg_id) THEN
    v_rg_id := CREATE_GROUP_FROM_QUERY(cst_rg_name,p_query);
    END IF;
    IF POPULATE_GROUP(v_rg_id) = 0 THEN
    POPULATE_LIST(p_list_item,v_rg_id);
    /* Force display of first list element label
    in the list item. */
    COPY(GET_LIST_ELEMENT_VALUE(p_list_item,1),p_list_item);
    END IF;
    END populate_list_with_query;
    3- Create When-Create-Record on the block level and write this code
    BEGIN
    POPULATE_LIST_WITH_QUERY('bk1.customer_name',
    'SELECT customer_name, to_char(customer_id) FROM customer');
    END;
    In this example, the customer name is the (visible) list label and the customer ID is the (actual) list value
    i hope this will solve your problem ...

  • Selecting Inputs From The Firebox In Logic

    Good morning all!
    I'm a new convert from Garageband to Logic Pro 8 as I can imagine many people here are too.
    My quick question involves the Prosonus Firebox. In Garageband when I started a new 'real instrument' track, I had the option (located in the bottom right of the screen) to choose what input from the Firebox I wanted to record from. Mono 1, Mono 2, Stereo 1/2, Stereo 3/4, etc.
    Where can I make that choice for input from the Firebox in Logic 8?
    Talk soon and thanks everyone!

    Channel strips for audio tracks have input and output boxes where you can choose where they take their input and where they send their output.
    The input and output settings are above the fader, and below the plugin insert slots on each channel strip.
    By default, the output is probably set to "Output 1&2" (your main stereo output) and above that is the input, which you can choose any single input from your audio interface (for mono channel strips) or pair of inputs (for stereo channel strips).
    Have a read through of the manual about channel strips if you're not sure of how to do this.
    Welcome to Logic!

  • Reading a "yes" or "no" from the keyboard

    Hello,
    I'm having difficulty reading a String or char from the keyboard using the Scanner class. It looks like there is a ShowConfirmationDialog in JOptionPane class, but I'd rather not use JOptionPane.
    Any suggestions??
    Thanks!

    One more thing, just to clarify. I'd like to be able to do something like this:
    import java.util.Scanner;
    Scanner console;
    console = new Scanner(System.in);
    System.out.print("Care for another game? (yes or no) ");
    answer = console.nextChar();
    ....but of course, there is no "nextChar()" method in the Scanner class.
    Help?

  • Shut down or restart from the keyboard?

    I have a G4 QuickSilver 2002 with two hard-drives and not having any problems at the time (knock on wood) but I was wondering is there a way to shut down and/or restart from the keyboard? In the past when I had to shut it down and could not use the normal way I was using the button on the front of the tower, I would hold it in until the computer shut down but I think that this has lead to a problem where I could not start the computer up at all and had to have some one come out and reset something, I am 100% disable and my hands shake so please overlook any error. I am running OS 9 and 10.4.8
    G4 Tower QuckSilver 2002 with OS 10.4.8   Mac OS X (10.4.6)   WallStreet Power Book with OS 9.2.2 & 10.2.8

    Hi Norbert,
    Forcing a shutdown can cause hard drive directory corruption. You should start from the install disc and repair the disk with Disk Utility.
    When other methods don't work, holding the power button to force a shutdown is the only way. You can try control-F12 (opens the Restart, Sleep, Shutdown dialog box) and then press return to shutdown or control-command-F12 (quit all applications and restart).
    If just one application is hanging try using Force Quit (command-option-esc). That will also work to force quit the Finder if it hangs.
    John

Maybe you are looking for

  • Reading an ElementType.LOCAL_VARIABLE

    I have been trying read a ElementType.LOCAL_VARIABLE annotation using reflect package. Here is my annotation: @Target(value={ElementType.TYPE,ElementType.LOCAL_VARIABLE}) @Retention(value=RetentionPolicy.RUNTIME) public @interface TestAnnotation{    

  • Wireless Bridge aironet 1410

    We have a site with couple of consumer level bridged AP's. We have been recommended a Cisco 1410 wireless bridge but it is very expensive. What are the added features of this bridge and is someone using it? We originally were thinking of replacing th

  • How do I get rid  of a download?

    I have a movie that was downloaded, but now, after thinking I deleted it, it keeps coming back. How do I get rid of the movie permanently?

  • Screen size and resolution mismatch after 2008-008 update.

    This is very odd. My screen is shifting around every time I move the mouse on my macbook pro. It appears that the mac doesn't think the full resolution will fit on the screen, and so shifts a few pixels up (or down, left, right) whenever I move aroun

  • Invalid Synonym on Database Package

    I have recently modified a database package spec and package body for the first time since our upgrade to Oracle 10.2.0.4.0. Once I ran my code to modify the package spec and package body, the synonym became invalid. I've read that this is a new feat