remove(): This method is available in java.util.Scanner class of Java.
Syntax:
void java.util.Scanner.remove()
The remove operation is not supported by this implementation of Iterator.
Parameters: NA
Returns: NA
Throws:
UnsupportedOperationException - if this method is invoked.
Approach
Java
import java.util.Scanner;public class Scannerremove {public static void main(String[] args) {String source = "Hello World";Scanner scanner = new Scanner(source);scanner.remove();System.out.println(scanner);scanner.close();}}
Output:
Exception in thread "main" java.lang.UnsupportedOperationException at java.base/java.util.Scanner.remove(Scanner.java:1490)
No comments:
Post a Comment