how to output user message into the console?

     how can i get the InputStream and OutputStream of the Console?
i want to output message into console and read the user input from the console.
who can help me?

best regards

Comment actions Permalink

does not anyone know?

Comment actions Permalink

There are 3 basic methodologies

  1. Using streams
  2. Using a scanner
    • introduced in Java 5
  3. Using the Console class
    • introduced in Java6
    • Will not work when the code is run from within an IDE (since the IDE does not have a console)

Here are some links to a few tutorials that will show you how to do this. The frist two are from the "official" Java Tutorial.

Eventually you will want to look at using a logging framework such as Simple Logging Facade for Java (SLF4J) over Logback rather than the console.

Comment actions Permalink

maybe I did not make it clear,i means than how to output the user message into the console of intellij,it is intellij's console,not system console


Please sign in to leave a comment.