2 Replies Latest reply on Nov 9, 2012 7:14 PM by 973487

    How can I read something from keyboard using i/o operations?

      I wrote the following code in java using *"oracle Jdeveloper 11g release 2"* platform and i think it's correct, but I have a little problem when I try to execute him, it asks me to introduce a number, and this it's correct, but I don't know how to introduce that number. If i want to write the same code in c or c++ using Visual Studio it's very easy when i want to introduce a number i must run the code and then a console window will appear and then i introduce the number.
      Could someone to give me a link at a tutorial about how to use *"oracle Jdeveloper 11g release 2"* when I have to use i/o operations or something useful.

      package instante;

      import java.io.*;

      public class Read_from_keyboard {
      public static void main(String[] args) {
      BufferedReader keyboard = new BufferedReader(new InputStreamReader(System.in), 1);
      double number_read = 0.0;
      String line = "";
      try {
      System.out.println("Give a number: ");
      line = keyboard.readLine();
      Double tmpDouble = Double.valueOf(line);
      number_read = tmpDouble.doubleValue();
      System.out.println("The number is: " + number_read);
      } catch (IOException e) {
      System.out.println(" Input from keyboard " + e.toString());

      Thank you!

      Edited by: Iosif on Nov 9, 2012 5:06 AM