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.
Useful material ππ
ReplyDeleteKeep it upππ
ReplyDeleteNice efforts π
ReplyDeleteKnowledgeful contentππ
ReplyDeleteLearning coding easyππ
ReplyDeleteAmazing content of java coding π π
ReplyDeleteKnowledge-based data
ReplyDeleteNice
ReplyDeleteKeep it up π―
ReplyDeleteUseful content
ReplyDeleteUnderstandable content of java programming language
ReplyDeleteKeep it up π―
ReplyDeleteππ
ReplyDeleteNice π
ReplyDeleteGreat work dear ☺️π☺️π☺️☺️☺️☺️
ReplyDeleteπππ―π―
ReplyDeleteπππ―π―
ReplyDeleteWith 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