System.out.println() and System.out.print() are only used method for output on console. But there is a class PrintStream a drived class of OutputStream having a implemented method write(), it can be used to write to the console. The simplest form of write() is :
void write (int byteValue)
The method writes to the stream in byte format by byte Value. The byte Value is declared as an integer but only low-order eight bits are written.
Example:
class DataWrite
{
public static void main(String args[])
{
int x;
x = ‘A’;
System.out.write(x);
System.out.write(‘\t’);
x= ‘p’ ;
System.out.write(x);
System.out.write(‘\n’);
}
}
Output: