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

What are the approaches that you will follow for making a program very efficient?

0 Answers  


Howmany classes that package java.applet.* contains?

1 Answers   TCS,


How to perform merge sort in java?

0 Answers  


What is the use of volatile in java?

0 Answers  


what is the purpose of "virtual"?

0 Answers   EDS,






What is a data structure java?

0 Answers  


how cani read a command line argument?(usingfile object).

3 Answers  


how to make hashmap object as synchronized object?

2 Answers   BOB Technologies,


Can we have this () and super () together?

0 Answers  


Difference between ‘>>’ and ‘>>>’ operators in java?

0 Answers  


How many bytes is a string java?

0 Answers  


What is boolean query?

0 Answers  


Categories