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 is arrays aslist in java?

515


What invokes a thread's run() method in java programming?

565


If try block is successfully executed, Then Is Finally block executed?

606


How do you write a conditional statement?

515


How can constructor chaining be done using this keyword?

587






What is use of inner class in java?

514


How will you initialize an Applet?

616


What is passing value java?

507


What is difference in between java class and bean?

562


Write a program to print fibonacci series up to count 10.

518


What is the difference between stream and buffer?

515


What is a substitution variable?

559


Is constructor inherited?

528


why java uses class level type casting ?

2251


Why we use protected in java?

530