Java PrintWriter println() methodThe println() method of java PrintWriter class consist of 10 types with parameters :- println() println(boolean b) println(char c) println(char[] s) println(inti) println(long l) println(float f) println(double d) println(String s) println(object obj) Java PrintWriter println() MethodThe println() method of Java PrintWriter class terminates the current line. It is done by writing the line separator string. SyntaxParameterNA Example 1Test it NowOutput: terminating the line... done! Example 2Output: terminating the line in file... done! check the file. Java PrintWriter println(boolean b) MethodThe println(boolean b) method of java PrintWriter class prints a value which is Boolean and terminates the current line by writing line separator string. This method behaves as it first invokes print(boolean) and then println(). SyntaxParameterb - the Boolean value. Example 1Test it NowOutput: Printing boolean and terminating the line... true done! Example 2Output: Printing boolean to the file and terminating the line... done! check the file. Java PrintWriter println(char c) MethodThe println(char c) method of Java PrintWriter class prints a character value and terminates the current line by writing line separator string. This method behaves as it first invokes print(char) and then println(). SyntaxParameterc - the character. Example 1Test it NowOutput: Printing char and terminating the line... s done! Example 2Output: Printing char to the file and terminating the line... done! check the file. Java PrintWriter println(char[] c ) MethodThe println(char[] c) method of Java PrintWriter class prints an array of characters and terminates the current line by writing line separator string. This method behaves as it first invokes print(char[]) and then println(). SyntaxParameterc - the array of characters. Example 1Test it NowOutput: Printing char array and terminating the line... shubham jadon done! Example 2Output: Printing char array to the file and terminating the line... done! check the file. Java PrintWriter println(int i) MethodThe println(int i) method of Java PrintWriter class prints an integer value and terminates the current line by writing line separator string. This method behaves as it first invokes print(int) and then println(). SyntaxParameteri - an integer value. Example 1Test it NowOutput: Printing int and terminating the line... 10 done! Example 2Output: Printing int to the file and terminating the line... done! check the file. Java PrintWriter println(long l) MethodThe println(long l) method of Java PrintWriter class prints a long value and terminates the current line by writing line separator string. This method behaves as it first invokes print(long) and then println(). SyntaxParameterl - the long value. Example 1Test it NowOutput: Printing long and terminating the line... 1003997 done! Example 2Output: Printing long to the file and terminating the line... done! check the file. Java PrintWriter println(float f) MethodThe println(float f) method of java PrintWriter class prints a float value and terminates the current line by writing line separator string. This method behaves as it first invokes print(float) and then println(). SyntaxParameterf - the float value. Example 1Test it NowOutput: Printing float and terminating the line... 1003997.0 done! Example 2Output: Printing float to the file and terminating the line... done! check the file. Java PrintWriter println(double d) MethodThe println(double d) method of Java PrintWriter class prints a double value and terminates the current line by writing line separator string. This method behaves as it first invokes print(double) and then println(). SyntaxParameterd - the double value. Example 1Test it NowOutput: Printing double and terminating the line... 1003997.0 done! Example 2Output: Printing double to the file and terminating the line... done! check the file. Java PrintWriter println(String s) MethodThe println(String s) method of Java PrintWriter class prints a String value and terminates the current line by writing line separator string. This method behaves as it first invokes print(String) and then println(). SyntaxParameters - the string value. Example 1Test it NowOutput: Printing string and terminating the line... My name is Shubham Jadon. done! Example 2Output: Printing string to the file and terminating the line... done! check the file. Java PrintWriter println(object obj) MethodThe println(object obj) method of Java PrintWriter class prints an object and terminates the current line by writing line separator string. This method behaves as it first invokes print(object) and then println(). SyntaxParameterobj - the object. Example 1Test it NowOutput: Printing object and terminating the line... My name is Shubham Jadon. done! Example 2Output: Printing object to the file and terminating the line... done! check the file.
Next TopicJava PrintWriter
|