System.out.println() Explained

Java Spring Decoded
Javarevisited
Published in
Apr 12, 2023

System — Concrete Class

Out — Static Reference of Print Stream Class Present in System Class that’s why it is accessible via Class reference.

println — It is a public method present in PrintStream class , which is responsible for printing output , we can override this method also by extending the PrintStream Class.

Performance Analysis of System.out.println()

println() is a method that helps display output on a console. This might be dependent on various factors that drives the performance of this method. The message passed using println() is passed to the server’s console where kernel time is required to execute the task. Kernel time refers to the CPU time. Since println() is a synchronized method, so when multiple threads are passed could lead to the low-performance issue. System.out.println() is a slow operation as it incurs heavy overhead on the machine compared to most IO operations.

--

--

Java Spring Decoded
Javarevisited

All Articles related to java , spring , Backend Development and System Design.