Java Notes
HubArray IntroductionArray OperationsArray Programs — FundamentalsArray Interview QuestionsJagged Array in JavaMulti Dimensional ArrayOne Dimensional Arraybreak and continue in JavaDo-While Loop in JavaFor Loop in JavaIf-Else Statements in JavaNested Loops in JavaSwitch-Case in JavaWhile Loop in JavaJava Compilation ProcessFeatures of JavaYour First Java ProgramHistory of JavaJava EditionsJava Program StructureJDK, JRE, and JVMWhat is Java?Immutable Strings in JavaString Class in JavaString Interview QuestionsString MethodsString Programs — FundamentalsStringBuffer in JavaStringBuilder in JavaComments in JavaData Types in JavaIdentifiers in JavaInput and Output in JavaKeywords in JavaOperators in JavaType Casting in JavaVariables in JavaAbstract Class in JavaAbstraction in JavaAnonymous Class in JavaClass and Object in JavaConstructor in JavaEncapsulation in JavaInheritance in JavaInner Class in JavaInterface in JavaMethod Overloading in JavaMethod Overriding in JavaObject Class in JavaObject Cloning in JavaOOPs IntroductionPolymorphism in Javastatic Keyword in Javasuper Keyword in Javathis Keyword in JavaWrapper Class in JavaCollections Framework OverviewCollections Practice ProgramsComparable vs Comparator in JavaGenerics in JavaIterator in JavaArrayList in JavaLinkedList in JavaStack in Java — Collections FrameworkVector in JavaHashMap in JavaHashtable in JavaLinkedHashMap in JavaTreeMap in JavaArrayDeque in JavaDeque Interface in JavaPriorityQueue in JavaHashSet in JavaLinkedHashSet in JavaTreeSet in JavaException Handling Best PracticesCustom Exceptions in JavaException Hierarchy in JavaFinally Block in JavaException Handling Introductionthrow and throws Keywords in JavaTry-Catch Block in JavaBuffered Streams in JavaByte Streams in JavaCharacter Streams in JavaDeserialization in JavaFile Class in JavaJava NIO PackageSerialization in JavaDate and Time API in Java 8Default and Static Methods in InterfacesFunctional Interface in Java 8Lambda Expression in Java 8Method Reference in Java 8Optional Class in Java 8Stream API in Java 8Creating Threads in JavaDaemon Threads in JavaExecutor Framework in JavaInter-Thread Communication in JavaMultithreading Programs in JavaRunnable Interface in JavaSynchronization in JavaThread Class in JavaThread IntroductionThread Life Cycle in JavaThread Priority in JavaBatch Processing in JDBCCallableStatement in JDBCJDBC ArchitectureJDBC IntroductionJDBC ProjectsMySQL Connection with JDBCPreparedStatement in JDBCResultSet in JDBCStatement Interface in JDBCTransaction Management in JDBCCookies in ServletsExpression Language (EL)GenericServletHttpServletJSP IntroductionJSP Tags and JSTLMVC ArchitectureRequest and Response ObjectsServlet IntroductionServlet Life CycleSession TrackingDependency InjectionAPI GatewayConfig ServerDocker DeploymentEureka Server - Service DiscoverySpring BeansCRUD ApplicationException Handling in Spring BootJWT Authentication — Java ProgrammingREST API with Spring BootSpring SecuritySpring Boot IntroductionSpring Data JPAValidation in Spring BootSpring Core ContainerSpring Framework IntroductionDynamic Programming in JavaGraph Data Structure in JavaHashing in JavaHeap (DSA)Linked List in JavaQueue in JavaRecursion in JavaSearching Algorithms in JavaSorting Algorithms in JavaStack in Java — DSA in JavaTime ComplexityTree Data Structure in JavaAdapter Design PatternBuilder Design PatternFactory Design PatternMVC Pattern — Java ProgrammingObserver Design PatternSingleton Design PatternArray Programs — PracticeBasic Java ProgramsCollection ProgramsJDBC ProgramsMultithreading ProgramsOOP ProgramsPlacement Coding QuestionsString Programs — PracticeBanking System — Java ProgrammingChat ApplicationE-Commerce BackendEmployee Management SystemLibrary Management System — Java ProgrammingSpring Boot Fullstack ProjectStudent Management System — Java ProgrammingCoding Interview QuestionsCollections Interview QuestionsCore Java Interview QuestionsJDBC Interview QuestionsMultithreading Interview QuestionsOOPs Interview QuestionsSpring Framework Interview QuestionsJava Cheat SheetImportant Formulas & ConceptsImportant Java ProgramsQuick Revision Notes — Java ProgrammingJava Master Course - Learning Roadmap
Concise Java quick revision notes covering all major topics - OOP, Collections, Multithreading, JDBC, Spring Boot in table format for fast review before exams or interviews.
Core Java Fundamentals
| Concept | Key Points |
|---|---|
| JVM | Executes bytecode, platform-specific |
| JRE | JVM + core libraries |
| JDK | JRE + dev tools (javac, jdb) |
| main() | public static void main(String[] args) |
| Data types | byte(1), short(2), int(4), long(8), float(4), double(8), char(2), boolean |
| Wrapper | Integer, Double, Character, Boolean (autoboxing/unboxing) |
| String Pool | Literals stored in pool for reuse; new String() creates in heap |
| final | Variable=constant, Method=no override, Class=no inherit |
| static | Belongs to class, not instance; shared across all objects |
Exception Handling
| ├── Error (don't catch | OutOfMemoryError, StackOverflowError) |
| ├── Checked (must handle | IOException, SQLException) |
| └── RuntimeException (unchecked | NullPointer, ArrayIndexOutOfBounds) |
| Keyword | Purpose |
|---|---|
| try | Code that may throw |
| catch | Handle exception |
| finally | Always executes (cleanup) |
| throw | Throw an exception |
| throws | Declare method may throw |
Collections Framework
| Interface | Implementations | Ordered | Duplicates | Null |
|---|---|---|---|---|
| List | ArrayList, LinkedList, Vector | ✅ | ✅ | ✅ |
| Set | HashSet, TreeSet, LinkedHashSet | Varies | ❌ | 1 null (HashSet) |
| Queue | PriorityQueue, ArrayDeque | FIFO/Priority | ✅ | ❌ |
| Map | HashMap, TreeMap, LinkedHashMap | Varies | Keys: ❌ | 1 null key (HashMap) |
HashMap Internals
- Array of buckets (Node[])
- hash(key) → bucket index
- Collision → Linked List (≤8) → Red-Black Tree (>8)
- Load factor: 0.75, resize at 75% full
Multithreading
| Topic | Key Point |
|---|---|
| Create thread | extends Thread OR implements Runnable |
| States | NEW → RUNNABLE → RUNNING → BLOCKED/WAITING → TERMINATED |
| synchronized | One thread at a time (monitor lock) |
| volatile | Ensures visibility across threads |
| wait()/notify() | Inter-thread communication (inside synchronized) |
| sleep() vs wait() | sleep doesn't release lock; wait does |
| ExecutorService | Thread pool management |
| AtomicInteger | Lock-free thread-safe operations |
| Deadlock | Two threads waiting for each other's locks |
JDBC Quick Reference
java example
// 1. Load driver (auto since JDBC 4.0)
// 2. Get connection
Connection conn = DriverManager.getConnection(url, user, pass);
// 3. Create statement
PreparedStatement ps = conn.prepareStatement("SELECT * FROM users WHERE id=?");
ps.setInt(1, id);
// 4. Execute
ResultSet rs = ps.executeQuery();
// 5. Process results
while (rs.next()) { String name = rs.getString("name"); }
// 6. Close resources (use try-with-resources)Spring Boot Essentials
| Annotation | Purpose |
|---|---|
| @SpringBootApplication | Main class (Config + AutoConfig + ComponentScan) |
| @RestController | REST API controller |
| @GetMapping / @PostMapping | HTTP method mapping |
| @PathVariable | URL path parameter |
| @RequestParam | Query parameter |
| @RequestBody | JSON body → Object |
| @Autowired | Dependency injection |
| @Service | Business layer bean |
| @Repository | Data layer bean |
| @Entity | JPA database entity |
| @Transactional | Database transaction |
| @Valid | Input validation |
| @ExceptionHandler | Handle exceptions |
Spring Boot Layers
Example
Controller → Service → Repository → Database
↑ ↑ ↑
@RestController @Service @Repository
DTOs Business Logic JPA/Hibernate
Design Patterns (Key Ones)
| Pattern | Purpose | Java Example |
|---|---|---|
| Singleton | One instance only | Runtime.getRuntime() |
| Factory | Create objects without specifying class | Calendar.getInstance() |
| Builder | Step-by-step object construction | StringBuilder |
| Observer | Notify dependents of changes | Event listeners |
| Strategy | Swappable algorithms | Comparator |
| Iterator | Sequential access | Iterator interface |
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Quick Revision Notes — Java Programming.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this Java Master Course topic.
Search Terms
java-master-course, java master course, java, master, course, notes, quick, revision
Related Java Master Course Topics
Continue learning this concept
NotesJava Cheat SheetComplete Java programming cheat sheet with syntax reference, common operations, built-in methods, and code snippets for quick lookup.NotesImportant Formulas & ConceptsEssential Java formulas, time complexity reference, bit manipulation tricks, and mathematical concepts used in programming and DSA.NotesImportant Java ProgramsCollection of most important Java programs frequently asked in exams and interviews - patterns, number programs, string programs, and array programs.Collections FrameworkCollections Framework OverviewComplete guide to Java Collections Framework covering hierarchy, interfaces, implementations, algorithms, and choosing the right collection for your use case.Collections FrameworkCollections Practice ProgramsComprehensive Java Collections practice programs covering List, Set, Map, Queue operations with solutions, explanations, and time complexity analysis.Collections FrameworkComparable vs Comparator in JavaDeep dive into Comparable and Comparator interfaces in Java — natural ordering, custom sorting, lambda expressions, method references, and practical comparisons with examples.