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 light weight component?

3 Answers  


When you declare a method as abstract method ?

2 Answers   HP,


extending thread class or implementing runnable interface. Which is better? : Java thread

0 Answers  


Can a vector contain heterogenous objects?

0 Answers  


StringBuilder s = new StringBuilder("Hello Mom");s.append(",I mean,Mother"); Response.Write(s.ToString()); String s = "Hello Mom"; s+ = ",I mean Mom"; Response.Write(s); Which is faster ? which uses the most memory?

6 Answers   HCL,






How many bits is a char?

0 Answers  


How many types of array are there?

0 Answers  


what is use of functional interface in java 8?

0 Answers  


What does main method?

0 Answers  


Is array dynamic in java?

0 Answers  


What are the override methods in Object class?

2 Answers   Tech Mahindra, Wipro,


What is the use of using enum to declare a constant?

0 Answers   Fidelity,


Categories