what is system.out.println in Java?

what is system.out.println in Java?



System.out.println is a Java statement that prints the argument passed into the console which is generally standard output.
In detail:
1)    system is the name of the class in java.lang package.
2)    out is an object of print stream class and declared as static in System class. Present in java.lang package.
3)    println() is a method of the PrintStream class. Present in the java.io package.
Explaning System.out.println using Java Programs:
Class A Program:
class A
{
 int i,j;
 void funA()
 {
  System.out.println("FunA() of A");
 }
}

Class Sdemo program:
class Sdemo
{
 static int i = 1;
 static A a1 = new A();
}

Class Test program:
class Test
{
 public static void main(String[] args)
 {
  System.out.println(Sdemo.i);
  System.out.println(Sdemo.a1);
  Sdemo.a1.funA();
 }
}

In the above program look at the Sdemo.a1.funA();
1)    Sdemo is the name of the class.
2)    a1 is the object of Class A which is declared as static in Sdemo class.
3)    funA() is a method of A class. Like Sdemo.a1.funA(); System.out.println() is also declared.
Share:

Search This Blog

  • ()

Our Services

Powered by Blogger.

Top 20 Websites like Bookzz | Bookzz Alternatives Websites

The domain  Bookzz.org  isn’t into work anymore, and the world’s largest ebook library  Bookzz  has got a new domain name or its Alternati...