explain System.out.println()

Answer Posted / surya simhadri

System is a predefined class in lang package and out is a
static member with in a System class and also out is an
instance of PrintStream which is a static inner class of
System class and finally print() and println() are member
functions of PrintStream class. So we can call those
methods using out and out is called with class name in
which it is declared( bcoz it is static member variable of
system class). So finally we can call println as
System.out.println().
EX:
class System {
static public PrintStream out;
public static class PrintStream {
public string print(String s) {

}
public string println(String s) {

}
public static void main(String[] arg) {
System.out=new PrintStream();
System.out.println("");
}

}
}

Is This Answer Correct ?    20 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are memory tables?

849


What is Classloader in Java?

843


What does I ++ mean?

830


What is the difference between static class and normal class?

761


Is call by reference possible in java?

742


Which package is always imported by default?

797


Why isn’t there operator overloading?

820


What is finalize()? Is finalize() similar to a destructor?

760


When we should use serialization?

804


Explain OOPs concept.

857


why an outer class cannot be declared as private?

3929


What is a java lambda expression?

793


What is meant by overloading?

824


What is the purpose of encapsulation?

754


What is method overloading with type promotion?

939