Console Input/Output in Java


Input/Output in Java can be done using the keyboard and screen, using files some combination of these methods. 

* Input typed at the keyboard and output displa on the screen are often referred to as console     input/output.

* Interactive input/output using the keyboard and screen is the default way of do

input/output in Java.

Note: An Object is always needed to perform an input/output operation in Java.

 Standard Output

Displaying screen output in Java is done using the System.out object. You do not need to create the System.out object. It is always available for you in a Java program

There are three methods that can be used to display output

(a) print() Method

The print() method is often used to display a prompt or a portion of a line. I does not move the cursor to the beginning of a new line automatically.

E.g. class demo

{

   public static void main(String args[])


//Use of print() method

{

System.out.print(" Welcome");

System.out.print("Java").

}

}

Output:

Welcome Java

# The print() method sends information into a buffer. This buffer is not flushed until  (/n )newline (or end-of-line) character is sent. As a result, the print() method

points output on one line until a newline character is encountered.  The display to be brought to the next line by printing a newline character as System.out.print("\n");


(b) printin() Method

The printin() method displays output exactly the same as the print() method except that it will always move the cursor to the beginning of a new line as the last action it performs.



Comments

  1. Useful material 👍👍

    ReplyDelete
  2. Keep it up👍👍

    ReplyDelete
  3. Nice efforts 👌

    ReplyDelete
  4. Knowledgeful content👍👍

    ReplyDelete
  5. Learning coding easy👍👍

    ReplyDelete
  6. Amazing content of java coding 👏 👌

    ReplyDelete
  7. Knowledge-based data

    ReplyDelete
  8. Keep it up 💯

    ReplyDelete
  9. Understandable content of java programming language

    ReplyDelete
  10. Keep it up 💯

    ReplyDelete
  11. Great work dear ☺️😄☺️😄☺️☺️☺️☺️

    ReplyDelete
  12. 👍👍💯💯

    ReplyDelete
  13. 👍👍💯💯

    ReplyDelete
  14. With the help of this data we learnt coding easy. Very useful and understandable information . Thankyou for this data provide to me and other paerson.

    ReplyDelete

Post a Comment

Popular posts from this blog

#Coding || Java || Inheritance

#Constructor

# How to write java program #Structure || Java Program