Java Advanced Topics Summary Sheet
1. Byte vs Character Streams: Byte streams (InputStream/OutputStream) handle binary data; Character
streams (Reader/Writer) handle text.
2. BufferedReader/Writer: Used for efficient I/O. BufferedReader reads lines; BufferedWriter writes with
buffering.
3. Serialization: Converts objects into byte stream using Serializable. Use ObjectOutputStream/InputStream.
4. File Copy Example: Use FileInputStream and FileOutputStream with buffer.
5. RandomAccessFile: Allows reading/writing at a specific file location.
6. JDBC Steps: Load driver, connect DB, create statement, execute query, close connection.
7. Statement vs PreparedStatement: PreparedStatement is precompiled and safer against SQL injection.
8. JDBC Insert: Use PreparedStatement to insert data into DB.
9. SQL Exception Handling: Use try-catch blocks and SQLException methods.
10. JDBC vs ODBC: JDBC is platform-independent and Java-specific; ODBC is native and not Java-specific.
11. TCP vs UDP: TCP is reliable/connection-based; UDP is fast/connectionless.
12. Client-Server Sockets: Use Socket (client) and ServerSocket (server).
13. ServerSocket/Socket: ServerSocket listens for clients; Socket connects and communicates.
14. Data Transmission: Via streams using read()/write() or buffered readers/writers.
15. Thread vs Runnable: Runnable is better for flexibility and multiple threads.
16. Synchronization: Prevents race conditions using synchronized blocks/methods.
17. Inter-thread Communication: Uses wait(), notify(), notifyAll().
18. Thread Lifecycle: New -> Runnable -> Running -> Waiting/Blocked -> Terminated.
19. RMI Architecture: Includes stub, skeleton, remote interface, and registry.
20. RMI Steps: Define interface, implement it, register object, and create client.
21. Remote vs Serializable: Remote is for remote method calls; Serializable is for object transport.
22. RMI Security: Use security manager and policy files.
23. JNI: Connects Java with C/C++ for native code execution.
24. JNI Integration: Write Java + native method, generate header, implement in C, compile.
25. JNI Pros/Cons: Access to native libraries but reduced portability and safety.
26. ArrayList vs LinkedList: ArrayList is fast for access; LinkedList is better for insertion/deletion.
27. HashMap vs Hashtable: HashMap is faster; Hashtable is thread-safe.
28. Iterator/ListIterator: Used to traverse collections; ListIterator supports reverse.
29. Set vs List: Set has no duplicates; List maintains order and allows duplicates.
30. Thread-Safe Collections: Use ConcurrentHashMap, synchronized wrappers, CopyOnWriteArrayList, etc.