JAVA中有这样的语法吗:
 一个字符串变量接受键盘的输入:
 String input;
 input=ConSole.readString();

解决方案 »

  1.   

    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String line = br.readLine();
      

  2.   

    我店里现在搞特价,质量有保证!买移动硬盘请选择我们绝对不后悔,你的最好选择。就在这【领先数码商城】移动硬盘专卖店:http://shop33473501.taobao.com/希望各位在解决问题的同时能够去逛下我的店,打搅了各位!!
      

  3.   

    import javax.swing.JOptionPane;
    String str = JOptionPane.showInputDialog("put number");
    System.out.println(str);
      

  4.   

    Console Input
    The console window is the [black] window that is automatically launched when you run a program from within CodeWarrior.  Console input is any input that is entered in the console window instead of typing it into a field or dialog box that pops up in a window.  For example, when the readLine method is called, the program waits for the user to enter information.  Whatever the user types is returned to the program in the form of a String object.
    We will use the System.in object to create an instance of the InputStreamReader class and then use that object to create an instance of the BufferedReader class.Steps for console based user input:
    Use the System.in object to create an InputStreamReader object. 
    Use the InputStreamReader object to create a BufferedReader object. 
    Display a prompt to the user for the desired data. 
    Use the BufferedReader object to read a line of text from the user. 
    Do something interesting with the input received from the user. 
    Would you like to see some code?  I thought so.  Here it is:
        // 1. Create an InputStreamReader using the standard input stream.
        InputStreamReader isr = new InputStreamReader( System.in );    // 2. Create a BufferedReader using the InputStreamReader created.
        BufferedReader stdin = new BufferedReader( isr );    // 3. Don't forget to prompt the user
        System.out.print( "Type some data for the program: " );    // 4. Use the BufferedReader to read a line of text from the user.
        String input = stdin.readLine();    // 5. Now, you can do anything with the input string that you need to.
        // Like, output it to the user.
        System.out.println( "input = " + input );
    That's a lot of code for one line of input.  Is there a shorter way?
    Yes, most Java programmers combine steps 1 & 2 and create only one instance of the BufferedReader for use throughout their entire program.  All keyboard operations will use that single shared BufferedReader object.  The code below is placed with other class data members and is not inside any method.
      

  5.   

    Yes, most Java programmers combine steps 1 & 2 and create only one instance of the BufferedReader for use throughout their entire program.  All keyboard operations will use that single shared BufferedReader object.  The code below is placed with other class data members and is not inside any method.  I added the above code to my program and I get compiler errors!
        // 1&2. Create a single shared BufferedReader for keyboard input.
        private static BufferedReader stdin = new BufferedReader( 
            new InputStreamReader( System.in ) );import java.io.*;  // needed for BufferedReader, InputStreamReader, etc.    /** A Java program that demonstrates console based input and output. */
        public class MyConsoleIO 
        {
            // Create a single shared BufferedReader for keyboard input
            private static BufferedReader stdin = 
                new BufferedReader( new InputStreamReader( System.in ) );        // Program execution starts here
            public static void main ( String [] args ) throws IOException
            {
                // Prompt the user
                System.out.print( "Type some data for the program: " );
                // Read a line of text from the user.
                String input = stdin.readLine();            // Display the input back to the user.
                System.out.println( "input = " + input );        } // end main method    } // end MyConsoleIO class
      

  6.   

    JDK1.5中Util包中的Scanner类
    Scanner f=new Scanner(System.in)
      

  7.   

    String input;
     input=System.in.read();