how system.out.println() works?

Answers were Sorted based on User's Feedback



how system.out.println() works?..

Answer / subbu

//the System class belongs to java.lang package
class System {
public static final PrintStream out;
//...
}

//the Prinstream class belongs to java.io package
class PrintStream{
public void println();
//...
}

java.lang package is default package hence no need to import
additionaly to use System class

System is having static reference of PrintStream class whihc
has println() method.

So we can directly acces the println() using out referece.

System.out.println();

Is This Answer Correct ?    16 Yes 0 No

how system.out.println() works?..

Answer / manish

In system.out.println()
'System' is a class which is having reference variable 'out' of type printStream class, and PrintStream class having overlaodded methed 'println()' for different purposes..

Is This Answer Correct ?    7 Yes 0 No

Post New Answer

More Core Java Interview Questions

What is the difference between overriding and overloading in OOPS.

0 Answers   Axtria, ITC Indian Tobacco Company,


What is the use of beaninfo?

0 Answers  


How many types of memory areas are allocated by jvm?

0 Answers  


How does hashmap work in java ?

0 Answers  


Is upper case in java?

0 Answers  






When do you create an index?

0 Answers  


Is alive method in java?

0 Answers  


Is 0 true or is 1 true?

0 Answers  


What is memory leak and how does java handle it?

0 Answers  


Why super is first line in java?

0 Answers  


What is difference between calling start() and run() method of thread?

0 Answers  


What are the types of literals?

0 Answers  


Categories