Formatter ioException() in Java

ioException(): This method is available in java.util.Formatter class of Java.

Syntax:

IOException java.util.Formatter.ioException()

This method returns the IOException last thrown by this formatter's Appendable.

Parameters: NA

Returns: The last exception thrown by the Appendable or null if no such exception exists.

Exceptions: NA

Approach

Java

import java.util.Formatter;
import java.util.Locale;

public class FormatterioException {
    public static void main(String[] args) {

        StringBuffer buffer = new StringBuffer();

        @SuppressWarnings("resource")
        Formatter formatter = new Formatter(buffer, Locale.UK);

        System.out.println(formatter.ioException());

    }
}

Output:

null


No comments:

Post a Comment