How exactly the line is printed to the "Console" using System.out.print ()

If I want to print a line

This is the Java programming language

to the console using System.out.print(), which and how many processes are used to print this line, and how can we compare it with writing the same line to a file using FileWriteror BufferedWriter.

+5
source share
3 answers

Check the PrintStream.java file for the print process .

Check here for a detailed flow of the process.

+1
source

Different Java implementations may have different ways of doing this. You can check their source if you are interested in how this is done.

For example, in HotSpotVM, outis a link java.io.PrintStreamthat internally uses java.io.BufferedWriterto write to standard output.

0
source

All Articles