初学java,觉得java的输入不太方便,请问大家有没有专门用于输入的java输入类,谢谢。

解决方案 »

  1.   

    JOptionPane类中的方法挺好的。
    可以看看SDK里面的帮助。而在jdk15.0以后有了新的方法来代替JOptionPane
    Console Input
    Prior to JDK 5.0, there was no Scanner class. Use JOptionPane.showInputDialog instead.5.0 
    Scanner in = new Scanner(System.in);
    System.out.print(prompt);
    int n = in.nextInt();
    double x = in.nextDouble();
    String s = in.nextLine(); 1.4
     String input = JOptionPane.showInputDialog(prompt);
    int n = Integer.parseInt(input);
    double x = Double.parseDouble(input);
    s = input; 
      

  2.   

    improt java.lang.*    class{System.out.println("asd");
    }
      

  3.   

    抱歉
    improt java.lang.*    class{
    String a = System.in.read(); //System.in的read方法可能抛出异常(java.io.IOException)
    }
      

  4.   

    都快6.0了 
    还用这些落后的啊
    用Scanner
    自己看api去
      

  5.   

    哦,谢谢大家
    api中说的很清楚