Core Java - Interview Questions and Answers for 'Input output' | Search Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com

Search Interview Questions


 More than 3000 questions in repository.
 There are more than 900 unanswered questions.
Click here and help us by providing the answer.
 Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company      Label / Company / Text

   



Core Java - Interview Questions and Answers for 'Input output' - 13 question(s) found - Order By Rating

 Q1. Why do we need to close the Scanner ?Core Java
Ans. For releasing input stream reference (System.in), you should close scanner.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     scanner  input output  io


 Q2. What is the difference between hasNextInt and nextInt method of scanner class ?Core Java
Ans. The hasNextInt() is used to check if there are any more elements left and the nextInt() is used to access that element.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     input output  Scanner


 Q3. Difference between System.out.printf and System.out.println ?Core Java
Ans. println prints an additional end of line whereas printf doesnt.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     System class  Streams  Input Output  println  printf


 Q4. Explain System.out.println ?Core Java
Ans. System is a class within java.lang package that contains several useful class fields and methods. It cannot be instantiated and hence can use only statically.even in this case this has been used statically i.e with class name itself and without creating an instance.

out is the static reference of Printstream declared as following in the System Class -

public final static PrintStream out = null;

println is the method of PrintStream class.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     System class  Streams  Input Output  println     Asked in 1 Companies      basic        frequent


 Q5. What is System.in in Java ?Core Java
Ans. It is an InputSream which is usually connected to the keyboard input of console program.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     System.in  Input Stream  Input Output


 Q6. What is the difference between System.console.write and System.out.println ?
Ans. System.console() returns null if your application is not run in a terminal (though you can handle this in your application)System.console() provides methods for reading password without echoing charactersSystem.out and System.err use the default platform encoding, while the Console class output methods use the console encoding

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   system class   system.out.println   system.console.write   input output   java6      intermediate        rare


 Q7. Tell something about BufferedWriter ? What are flush() and close() used for ?
Ans. BufferedWriter is temporary source for data storage.BufferedWriter is used to write character data to the file.Flush() is method available in B.W which ensures that all data items are written to file including last character.Close() is used to closes the character output stream.

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   java io   input output   file handling   file io   output stream   bufferedwriter   flush   close


 Q8. Name few Buffered IO classes and interfaces ?
Ans. http://www.buggybread.com/2015/01/java-io-buffered-classes-and-interfaces.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   io   input output   buffered io   buffered input output


 Q9. Name few IO Stream classes and interfaces ?Core Java
Ans. http://www.buggybread.com/2015/01/java-stream-io-classes-and-interfaces.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   io   input output   stream


 Q10. Name few Writer classes ?
Ans. http://www.buggybread.com/2015/01/java-output-writer-classes-and.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   input output   io   writer


 Q11. Name few Reader classes ?
Ans. http://www.buggybread.com/2015/01/java-input-reader-classes-and-interfaces.html

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   input output   io   reader


 Q12. Name few File IO related classes and interfaces ?Core Java
Ans. http://www.buggybread.com/2015/01/java-file-io-classes-and-interfaces.html

  Sample Code for File

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   io   input output   file io  file handling


 Q13. Difference between Scanner and BufferedReader ? Which one is faster and Why ?Core Java
Ans. Scanner is used for parsing tokens from the contents of the stream while BufferedReader just reads the stream.

BufferedReader read files efficiently by using a buffer to avoid physical disk operations.

Buffer size of Scanner is usually smaller than the Buffered Writer.

BufferedReader is faster that Scanner as it just reads the Stream and doesn't Parse the tokens to read the stream into primitive data types.

  Sample Code for Scanner

  Sample Code for BufferedReader

 Help us improve. Please let us know the company, where you were asked this question :   

   Like         Discuss         Correct / Improve     java   file io   input output   scanner   bufferedreader  file handling



Help us and Others Improve. Please let us know the questions asked in any of your previous interview.

Any input from you will be highly appreciated and It will unlock the application for 10 more requests.

Company Name:
Questions Asked: