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 different type of exceptions in java?

0 Answers  


Why main() method is public, static and void in java ?

0 Answers  


How can be define MARKER interfce in java

1 Answers  


What the difference is between execute, execute Query, execute Update?

0 Answers  


What is java virtual machine? Explain

0 Answers  






How to sort a vector elements that contains the user define class object? (Note: If Suppose consider, A Student class contain two data members. They are String studentName and int rollNo. I am creating Four objects for this class, each object contains students details like name and roll no. Now i am storing that objects in vector and if i retiving the elements from the vector means then it should be display in sorting order)

3 Answers   ProdEx Technologies,


Name component subclasses that support painting in java programming?

0 Answers  


What is e java?

0 Answers  


What are keywords give examples?

0 Answers  


Is intellij better than eclipse?

0 Answers  


Can you call a method on a null object?

0 Answers  


What is difference between stringbuffer and string?

0 Answers  


Categories