Write a statement that throws an IOException with the customized message “really BAD data”.

4
Write a statement that throws an IOException with the customized message “really BAD data”.

LANGUAGE: JAVA

CHALLENGE:

Write a statement that throws an IOException with the customized message “really BAD data”.

SOLUTION:


throw new IOException("really BAD data");

4 comments

  • balsal says:

    throw new IOException(“really BAD data”);

  • MarlonRando33 says:

    /* 21188 – The argument to a square root method (sqrt) in general should not be negative. Write the definition of a class named SQRTException whose objects are created by specifying the original negative value that caused the problem in the first place: new SQRTException(originalArgument). The associated message for this Exception should be “Bad argument to sqrt: ” followed by the value specified at the time of instantiation .
    */
    public class SQRTException extends Exception{
    public SQRTException(double badvalue){
    super(“Bad argument to sqrt: ” + badvalue);
    }
    }

  • KenM66 says:

    That one doesn’t work Marlon

  • shusma kafle says:

    public class SQRTException extends Exception {
    public SQRTException(double d) {
    super(“Bad argument to sqrt: ” + d);
    }
    }

Add comment