Javatpoint Logo

Related to PrintStream class

By: ravi.k*** On: Sun Jul 23 12:31:27 IST 2017     Question Reputation0 Answer Reputation0 Quiz Belt Series Points0  0Blank User
we know that in a java Non static member we can not access directly but it can required to access the object of class. and we can access by directly by references of class , just like
class Demo
{
void m1()
{ System.out.println("Hello"); }
public static void main(System[] args)
{
new Demo().m1();
}
}
same as a we know that in java System is a class of lang sub package and PrintStream is a class of Io stream class and it has a many method but
Why we can not access directly a method of the iostream class by references of PrintStream class just like

new PrintStream().println();

Why we require the System.out.println(); why?
Up0Down