Define the various Input/Output methods of JAVA.
Advertisements
Question
Define the various Input/Output methods of JAVA.
Definition
Advertisements
Solution
The various Input/Output methods of Java are as follows:
System.out.print(): This method is used to display text or values on the screen without moving the cursor to the next line.System.out.println(): This method is used to display text or values on the screen and move the cursor to the next line.System.out.printf(): This method is used to display formatted output using format specifiers.ScannerClass: The Scanner class is used to accept input from the keyboard. It provides methods such asnextInt(),nextFloat(),nextDouble()andnextLine().BufferedReaderClass: This class is used to read text input efficiently. ItsreadLine()method reads a complete line of text.DataInputStreamClass: This class is used to read primitive data types from an input stream. It provides methods such asreadInt(),readFloat()andreadDouble().
shaalaa.com
Is there an error in this question or solution?
