ioException(): This method is available in java.util.Scanner class of Java.
Syntax:
IOException java.util.Scanner.ioException()
This method returns the IOException last thrown by this Scanner's underlying Readable.
Note: This method returns null if no such exception exists.
Parameters: NA
Returns: the last exception thrown by this scanner's readable.
Exceptions: NA
Approach
Java
import java.util.Scanner;public class ScannerioException {public static void main(String[] args) {String source = "Hello World";Scanner scanner = new Scanner(source);System.out.println(scanner.ioException());scanner.close();}}
Output:
null
No comments:
Post a Comment