Java Scanner remove() MethodThe remove() method of Java Scanner class is used when remove operation is not supported by this implementation of Iterator. SyntaxFollowing is the declaration of remove() method: ParameterThis method does not accept any parameter. ReturnsThe remove() method does not return any value. ExceptionsUnsupportedOperationException- It will thrown exception if this method is invoked. Compatibility VersionJava 1.5 and above Example 1Output: Hi All! This is JavaTpoint. Exception in thread "main" java.lang.UnsupportedOperationException at java.base/java.util.Scanner.remove(Scanner.java:1490) at myPackage.ScannerRemoveExample1.main(ScannerRemoveExample1.java:10) Example 2Output: Enter Your Name: Java Name: Java Exception Found. Exception in thread "main" java.lang.UnsupportedOperationException at java.base/java.util.Scanner.remove(Scanner.java:1490) at myPackage.ScannerRemoveExample2.main(ScannerRemoveExample2.java:12) Next TopicJava-scanner-reset-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India