The ioException() method of java.util.Scanner class returns the IOException last thrown by this Scanner’s underlying Readable. This method returns null if no such exception exists.
public IOException ioException()
Return Value: This function returns the last exception thrown by this scanner’s readable.
Below programs illustrate the above function:
gfg geeks! null
gopal dave! null
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready.