Java - IO - Interview Questions and Answers on Scanner

Q1.  What is Scanner class used for ? when was it introduced in Java ?

Ans. Scanner class introduced in Java 1.5 for reading Data Stream from the imput device. Previously we used to write code to read a input using DataInputStream. After reading the stream , we can convert into respective data type using as String ,in.nextInt() as integer, in.nextDouble() as Double etc 

Q2. Which interfaces are implemented by Scanner?

Ans.[, Closeable, AutoCloseable, Iterator<String>]

Q3. Which is the Parent Class of Scanner class?

Q4. What is the package name for Scanner class?

Subscribe to Java News and Posts. Get latest updates and posts on Java from
Enter your email address:
Delivered by FeedBurner
comments powered by Disqus