13 June 2025

#Java_IO

#Java_IO
What is Java I/O?
What is the difference between byte stream and character stream in Java?
What is the purpose of the java.io.File class?
How does BufferedReader improve performance?
What is the difference between FileReader and BufferedReader?
What is the difference between InputStream and Reader?
What is the use of InputStreamReader and OutputStreamWriter?
How do you serialize an object in Java?
What is the role of transient keyword in serialization?
What happens if a non-serializable object is part of a serializable class?
What is the purpose of serialVersionUID?
How can you read a file line-by-line in Java?
What is the use of DataInputStream and DataOutputStream?
How does ObjectOutputStream work?
What are the standard streams in Java?
What is the difference between FileInputStream and FileReader?
How do you handle exceptions in Java I/O?
What is RandomAccessFile?
What is stream chaining in Java I/O?
How do mark() and reset() methods work in input streams?
What is the use of PushbackInputStream?
Can we use Java I/O in multithreaded applications?
How do you copy a file using Java I/O?
How do you ensure a stream is properly closed?
What are the limitations of traditional Java I/O?
What are the main classes in the java.io package?
Explain the difference between BufferedInputStream and BufferedOutputStream.
How does buffering improve I/O performance?
What is the use of PrintWriter in Java?
Can you write binary data using PrintWriter? Why or why not?
Explain the decorator pattern in the context of Java I/O.
What are the drawbacks of Java I/O?
What is a stream in Java I/O?
How many types of streams are there in Java?
What is the difference between flush() and close() methods in streams?
What is the difference between read() and readLine()?
What happens when you call close() on an already closed stream?
What is EOFException in Java I/O?
Explain the difference between FileOutputStream and ObjectOutputStream.
How does ObjectInputStream read objects?
What are the limitations of Java's serialization mechanism?
What is Externalizable and how is it different from Serializable?
What are transient and volatile in Java I/O context?
What is the difference between File.delete() and File.deleteOnExit()?
How do you read/write a UTF-encoded file in Java?
What is the use of FileDescriptor?
How can you check if a file exists before reading it?
How to list all files in a directory using Java?
Can you read from multiple files at once in Java?
What does File.canRead(), canWrite(), and canExecute() do?
How to check file permissions using Java?
What is the difference between Reader and InputStreamReader?
What is the use of LineNumberReader?
How to implement custom serialization in Java?
How can you make a class serializable but skip some fields?
How does Java handle circular references during serialization?
Can you override default serialization behavior?
How to serialize a list of custom objects?
How to write logs using Java I/O?
Can you read a file without loading the whole content into memory?
What is the use of SequenceInputStream?
Explain FilterInputStream and FilterOutputStream.
What is the difference between flush() and write()?
What happens if the output stream is not flushed before closing?
What are file channels and how are they different from streams?
Explain the use of BufferedReader.mark() and BufferedReader.reset().
What is the default buffer size used in buffered streams?
Why would you prefer PrintWriter over BufferedWriter?
Can you serialize static members?
Write code to read a file and count the number of lines.
Write code to find the longest line in a text file.
How would you handle large file reading in Java?
How to append to an existing file?
How to check file size using Java?
How to read a properties file using Java I/O?
How to write logs with timestamps to a file?
How to detect file encoding in Java?
How to monitor file changes in Java I/O?
How do you read from a zip file using Java I/O?
Explain how Java handles file locks.
How to handle encoding issues when reading files?
What are character encodings supported by Java I/O?
How to work with temporary files in Java?
Explain File.createTempFile() method.
What is a memory-mapped file in Java?
How is performance affected when using unbuffered I/O?
What is the use of File.listFiles(FileFilter)?
How does Java handle symbolic links?
What is the impact of GC on open streams?
How to unit test file reading methods?
What are the best practices for closing streams?
Why is try-with-resources preferred?
Can streams be reused once closed?
Is Java I/O thread-safe?
How to avoid memory leaks in I/O operations?
How to handle IOException cleanly?
How to wrap a stream with custom logic?
What is the use of File.renameTo()?
What?s the difference between BufferedWriter and PrintWriter?
Why is Serializable a marker interface?
  • Java I/O is stream-based
  • Byte streams (InputStream, OutputStream)
  • Character streams (Reader, Writer)
  • File class
  • BufferedReader/BufferedWriter or BufferedInputStream/BufferedOutputStream
  • ObjectInputStream/ObjectOutputStream
  • DataInputStream/DataOutputStream
  • PrintWriter and PrintStream
  • BufferedReader & InputStreamReader &
  • FileInputStream & FileOutputStream
  • FileReader/FileWriter
  • try-with-resources
  • Java I/O is blocking (synchronous)
  • RandomAccessFile
  • IOException.
  • OutputStreamWriter
  • BufferedReader.readLine()
  • File.separator
  • available()
  • PushbackInputStream and PushbackReader
  • file.canRead() or file.setWritable()
   Stream   

No comments:

Post a Comment

Most views on this month

Popular Posts