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 |
Is there a jre for java 11?
What are 3 boolean operators?
Why vector class is used?
In what ways you can handle exception ?
what is optional in java 8?
how to connect one jsp page to another jsp page????
Difference in the use of print, println, and printf.
Can you inherit from an abstract class java?
how we can use debug in myeclipse 6.0 in order solve the problems that exist in our program when there are 900 to 1000 pages in a web application
Can an arraylist be empty?
Can we declare static variables in JSP page.
Write POJO class as a key to hashmap???