Java - Interview Questions and Answers for 'Writer' | Search Java Interview Question - javasearch.buggybread.com
Javasearch.buggybread.com
Share

Search Java Interview Questions


 2137 questions in repository.
 There are more than 200 unanswered questions.
Click here and help us by providing the answer.
Label / Company      Label / Company / Text

   



Interview Questions and Answers for 'Writer' - 6 question(s) found - Order By Newest

 Q1. Tell something about BufferedWriter ? What are flush() and close() used for ?
Admin
info@buggybread.com
Ans. A Buffer is a temporary storage area for data. The BufferedWriter class is an output stream.It is an abstract class that creates a buffered character-output stream.Flush() is used to clear all the data characters stored in the buffer and clear the buffer.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


 Q2. What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?Core Java
Admin
info@buggybread.com
Ans. The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented

  Sample Code for InputStream

  Sample Code for OutputStream

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

   Like      Discuss      Correct / Improve     java   file io   streams   reader class   writer class   inputstream   outputstream   stream  file handling


 Q3. Which is the abstract parent class of FileWriter ?Core Java
Admin
info@buggybread.com
Ans. OutputStreamWriter

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

   Like      Discuss      Correct / Improve     java   io   file   fileio   filewriter   outputstreamwriter  file handling


 Q4. Which of the following code is correct ?

a.


FileWriter fileWriter = new FileWriter("../file.txt");
File file = new File(fileWriter );
BufferedWriter bufferedOutputWriter = new BufferedWriter(fileWriter);

b.

BufferedWriter bufferedOutputWriter = new BufferedWriter("../file.txt");
File file = new File(bufferedOutputWriter );
FileWriter fileWriter = new FileWriter(file);


c.

File file = new File("../file.txt");
FileWriter fileWriter = new FileWriter(file);
BufferedWriter bufferedOutputWriter = new BufferedWriter(fileWriter);

d.

File file = new File("../file.txt");
BufferedWriter bufferedOutputWriter = new BufferedWriter(file);
FileWriter fileWriter = new FileWriter(bufferedOutputWriter );
Core Java
Admin
info@buggybread.com
Ans. c.

File file = new File("../file.txt");
FileWriter fileWriter = new FileWriter(file);
BufferedWriter bufferedOutputWriter = new BufferedWriter(fileWriter);

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

   Like      Discuss      Correct / Improve     java   io   file   fileio   coding   code   filewriter   bufferedwriter   scjp   ocjp  file handling


 Q5. Name few Writer classes ?
Admin
info@buggybread.com
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


 Q6. How and when the Buffer is cleared when using Buffered Writer Classes ?Core Java2016-08-08 11:26:13

Ans. Buffer is cleared in 2 circumstances, i.e 1. naturally when the buffer is filled and 2. explicitly when the method flush is called ( for flushing the residual )

Ideally we just need to call flush once at the end of file writing so that the residual content should be dumped to file.

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

   Like      Discuss      Correct / Improve     BufferedWriter  Writer  PrintWriter  File io  flush  file handling




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



comments powered by Disqus
 

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:
         

X Close this

X Close this

Help Us Improve.
Please share your
interview experience.

Company Name:   


Questions Asked: