Deepika Saxena wrote:Could any body please explain why this statement is designed in such a way? i.e we are accessing a static method through an object , not from a System class.
Because adding all those println statements would pollute the System class with many, many extra methods. Instead of the 26 current methods, there would have to be an additional 31 for the output, 31 for the error and 9 for the input. Also, the names for output and error methods would have to be mangled to get a difference. You would get methods like printToOutput and printToError.
Also, any method that takes an input stream or output stream could no longer read from the standard input stream or write to the standard output / error stream.
By having System.out, System.err and System.in, these remain instances of PrintStream and InputStream, and can therefore be passed to methods.