Scanner class can be used to for performing which of the following operations ? (a) accept input from the keyboard (b) read from the file(c) parse a string separated by delimiters (d) All of the above
Answers
"Option: d, ALL THE ABOVE
The Scanner class in java can be used for accepting input via keyboard done by the user, reading from a file and to parse a string separated by delimiters. In short it can do all the specified tasks in the options. So, the correct choice of answer for the given question from the list of answers is (d) All of the above. The Scanner class in java is included under the java.util package and to set up an instance (named sc in this case) of the class the syntax is:
“Scanner sc = new Scanner(System.in)”;
The above instance of scanner will read input from system as input stream from keyboard. To perform other tasks, just replace the constructor parameter (which is System.in in this case) by the file name or string name.
"
Explanation:
parent class is reffered to a which class in object oriented programming launguage