Java Tutorial
void write(int byteval)
//Java code to Write a character in Console Output import java.io.*; class WriteCharacterTest { public static void main(String args[]) { int byteval; byteval = 'J'; System.out.write(byteval); System.out.write('\n'); } }Output:
$javac WriteCharacterTest.java $java WriteCharacterTest J
PrintWriter(OutputStream outputStream, boolean flushOnNewline)here outputStream is an object of OutputStream, and flushOnNewline is true to ensure whether java flushes the output every time a println() method is invoked. otherwise no flushing.
//Java code to Write Console Output using PrintWriter class import java.io.*; class PrintWriterTest { public static void main(String args[]) { PrintWriter pw = new PrintWriter(System.out, true); pw.println("PrintWriter class demo"); pw.println(100); pw.println(-4.67); } }Output:
PrintWriter class demo 100 -4.67
Java Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us | Report website issues in Github | Facebook page | Google+ page