printstream class method println() is calling using System
class and its static object out .how it is explain any one
in detail with example ?
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 |
Why are data types important?
What are the differences between heap and stack memory in java?
What are the five major types of reference sources?
Explain final, finalize() and finally?
How would you use Bubble Sort to sort the number of elements?
What is the return type of read()?
There are three interfaces A,B & C. A extends B, B extends C, and C extends A.Is it multiple Inheritance? please anybody help me.....
When can an object reference be cast to an interface reference in java programming?
What is static in java?
Explain JSP life cycle
what is the use of Clonable,and serializable interface?
What is anonymous class?