3 Replies Latest reply on Nov 11, 2012 10:01 PM by jschellSomeoneStoleMyAlias

    Writing to STDOUT, then reading from STDIN?

      I have been researching this lately, as i've been programming 5 years and never had the opportunity to use it.

      The documentation on the official Java tutorial is pretty scarce, but it SEEMS like i should be able to write to STDOUT, then have it wait for me until i read from STDIN.

      I tried the following code:
      PrintStream os = System.out;
      InputStream is = System.in;
      os.write("I HOPE THIS WORKS!!!!!!!!!".getBytes());
      int available = is.available();
      byte BYTE[] = new byte[6]; //just trying to read the first 6 bytes, for the heck of it!
      However, when i run the os.write method, the String just prints to the console. i thought my code was sufficient to reassign it and prevent it from being output there. what am i missing here?