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:

Our Services

Search This Blog

  • ()
Powered by Blogger.

C Data Types and Types of data types in C

Data types specify the type of data that a variable can store. All C compilers support Five fundamental data types, they are an integer(int...