Menu
Topics Index
...
`

CheckError


If you need explanation Read this topic

If you need Answer Take test on this topic

CheckError
What will be the output of the following program?
import java.io.*;
public class CheckError {
    public static void main(String args[]) {
        String str = "Error or Not";
        PrintWriter pw = new PrintWriter(System.out);
        pw.append(str);
        System.out.println(pw.checkError());
    }
}

A. Error or Nottrue
B. Error or Notfalse
C. Error or Not
true
D. Error or Not
false
E. Compilation Error or Runtime Error 
Topic: PrintWriter Class In Java

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans is B..
Bcoz System.out has no error...thats y false is appended after the string.. ----checkerror() method returns true if the print stream has encountered an error, either on the underlying output stream or during a format conversion else it returns false...here it returns false as there is no error..

Posted by Mânïshå Mùlchåndânï    2014-06-30 13:13:53


Ans is D...first it prints the string error or not and in the next line false is printed as there was no error

Posted by Badam Swathi    2014-06-30 15:44:57


Congratulations Mânïshå Mùlchåndânï. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-07-01 04:13:21


© meritcampus 2019

All Rights Reserved.

Open In App