printstream class method println() is calling using System
class and its static object out .how it is explain any one
in detail with example ?



printstream class method println() is calling using System class and its static object out .how it ..

Answer / chandan kumar

import java.io.*;
class Other
{
public static PrintStream wise;
static
{
try{
wise=new PrintStream(new FileOutputStream("abc.txt"));
}
catch(Exception e)
{

}
}

}
public class AB
{
public static void main(String arg[])
{
Other.wise.println("hi");
}
}
This will print hi on a file abc.txt
some thing like this is written in class System. A static
object out of PrintStream Class is defined in static block
and connected to a Stream Connected to Console.So everythin
that we write with in print()method comes out as output

Is This Answer Correct ?    12 Yes 2 No

Post New Answer

More Core Java Interview Questions

If an object is garbage collected, can it become reachable again?

0 Answers  


Explain differences between collection api and stream api?

0 Answers  


What is the largest long allowed by java?

0 Answers  


How do you square a number in java?

0 Answers  


How java enabled high performance?

0 Answers  


Is multiple inheritance allowed in Java? Why ?

7 Answers  


explain the collection in java

1 Answers   WDC,


Can you explain the cs option of java interpreter?

0 Answers  


What is OOP?

2 Answers   BMC, Microsoft,


What does ide stand for?

0 Answers  


Is passing by reference faster?

0 Answers  


Does chrome use java?

0 Answers  


Categories