Section 3: Core Java Concepts
Exception Handling
• try-catch-finally blocks handle exceptions
gracefully
• Common exceptions: NullPointerException,
ArrayIndexOutOfBoundsException
• Custom exceptions extend Exception or
RuntimeException
• Use throws keyword to propagate exceptions
Collections Framework
• Interfaces: List, Set, Map
• List: ArrayList, LinkedList
• Set: HashSet, TreeSet
• Map: HashMap, TreeMap
Generics in Java
• Enable type-safe operations
• Syntax: List<String> list = new ArrayList<>();
• Can be used in methods and classes
• Avoids ClassCastException
Wrapper Classes and Autoboxing
• Wrapper classes: Integer, Double, Boolean,
etc.
• Autoboxing: converting primitives to objects
automatically
• Unboxing: converting objects back to
primitives
• Useful in collections
File I/O in Java
• Classes: FileReader, BufferedReader,
FileWriter, Scanner
• Read/write files using streams
• Handle I/O exceptions
• Use try-with-resources for auto closing
Java 8 Features
• Lambda Expressions: concise way to write
anonymous methods
• Streams API: for functional-style operations on
collections
• Functional Interfaces: interfaces with one
abstract method
• Method references and default methods in
interfaces