30 May 2024

#CoreJava


Key Concepts


Topic Sub-Topics
Java Fundamentals JDK/JRE/JVM, Java 21 features, compilation, bytecode, runtime architecture
OOP & Design Encapsulation, inheritance, polymorphism, abstraction, composition, SOLID
Classes & Objects Constructors, records, enums, sealed classes, immutable objects
Interfaces Default methods, functional interfaces, interface-based agent/tool contracts
Generics Generic classes, methods, wildcards, bounded types, type-safe AI components
Collections Framework List, Set, Map, Queue, Deque, selection strategies for AI workloads
HashMap Internals Hashing, buckets, collisions, resizing, treeification, performance
Java Streams map, filter, reduce, collect, grouping, parallel streams, AI data pipelines
Functional Programming Lambda, method references, predicates, functions, consumers, suppliers
Exception Handling Checked/unchecked exceptions, custom exceptions, resilient AI services
I/O & NIO Files, Path, Channels, Buffers, asynchronous I/O, document ingestion
Date & Time API LocalDate, Instant, Duration, ZoneId, timestamps for AI workflows
Concurrency Fundamentals Threads, Runnable, Callable, synchronization, locks
Executors ExecutorService, ScheduledExecutorService, thread pools, task orchestration
CompletableFuture Async composition, chaining, parallel calls, error recovery for LLM APIs
Virtual Threads Java 21 virtual threads, blocking I/O, high-concurrency AI services
Synchronization synchronized, Lock, ReentrantLock, atomic classes, concurrent collections
Java Memory Model Heap, stack, happens-before, visibility, volatile, safe publication
JVM Internals Class loading, runtime areas, JIT, bytecode, JVM execution lifecycle
Garbage Collection G1 GC, generational GC, GC tuning, memory behavior of AI applications
Performance Engineering Profiling, CPU/memory bottlenecks, allocation, latency, throughput
Reflection & Annotations Reflection API, custom annotations, runtime metadata, tool discovery
Serialization JSON, Jackson, Java serialization, DTOs, structured AI messages
HTTP Client Java HttpClient, REST calls, async requests, LLM provider integration
Networking HTTP/HTTPS, connection pooling, retries, timeouts, resilient AI API communication
Design Patterns Factory, Builder, Strategy, Observer, Adapter, Chain of Responsibility
AI-Oriented Design Patterns Tool Registry, Agent Loop, Router, Planner, Memory, ReAct-style orchestration
Clean Architecture Domain, application, infrastructure layers, AI provider abstraction
Testing JUnit, Mockito, integration testing, async testing, AI service testing
Production Agentic AI Java + Spring AI, LLM integration, RAG, tool calling, memory, MCP, LangGraph4j-style orchestration, observability

Interview question

What is Java?
What the features of Java?
What is JVM?
What is JRE?
What is JDK?
What is the difference between JDK, JRE, and JVM?
How does Java achieve platform independence?
What is bytecode?
What is the main() method?
Can we overload the main() method?
Can we override the main() method?
What are command-line arguments?
What are variables in Java?
What are primitive data types?
What is type casting?
What is implicit casting?
What is explicit casting?
What are operators in Java?
What is the difference between == and equals()?
What is the difference between = and ==?
What is an object?
What is a class?
What is an instance variable?
What is a local variable?
What is a static variable?
What is a constructor?
What is the difference between constructor and method?
Can constructors be inherited?
Can constructors be private?
What is constructor overloading?
What is method overloading?
What is method overriding?
What is polymorphism?
What are the types of polymorphism?
What is inheritance?
What are the types of inheritance?
Why does Java not support multiple inheritance with classes?
What is encapsulation?
What is abstraction?
What is an abstract class?
What is an interface?
What is the difference between abstract class and interface?
Can an interface have default methods?
Can an interface have static methods?
What are marker interfaces?
What are access modifiers?
What is the difference between public, protected, default, and private?
What is the final keyword?
What is the finally block?
What is finalize()?
What is the difference between final, finally, and finalize()?
What is the static keyword?
What is a static block?
Can we override static methods?
What is the this keyword?
What is the super keyword?
What is object cloning?
What is shallow copy?
What is deep copy?
What is the Object class?
What are the methods of Object class?
What is hashCode()?
What is equals() contract?
What is toString()?
What is the difference between String, StringBuilder, and StringBuffer?
Why is String immutable?
What is the String Constant Pool?
What is intern()?
How are strings stored in memory?
What is garbage collection?
How does Garbage Collector work?
What are GC roots?
Can garbage collection be forced?
What are memory leaks in Java?
What is heap memory?
What is stack memory?
What is Metaspace?
What is OutOfMemoryError?
What is StackOverflowError?
What is exception handling?
What is the difference between checked and unchecked exceptions?
What is the difference between Error and Exception?
What is try-catch-finally?
What is try-with-resources?
How do you create a custom exception?
What is throw?
What is throws?
Can we catch multiple exceptions?
What is multi-catch?
What is reflection?
What is the Reflection API?
What are annotations?
What are built-in annotations?
What are custom annotations?
What is serialization?
What is deserialization?
What is transient?
What is volatile?
What is enum?
What is var in Java?
What are wrapper classes?
What is autoboxing and unboxing?
What is package?
What is import statement?
What is package-private access?
What is Java Memory Model?
What is pass-by-value in Java?
What is the difference between compile-time and runtime polymorphism?
What is covariant return type?
What is anonymous class?
What is inner class?
What is local inner class?
What is static nested class?
What is lambda expression?
What is functional interface?
What is method reference?
What are streams in Java?
What is Optional?
What is record in Java?
What is sealed class?
What is switch expression?
What are text blocks?
What are modules in Java?
How do you improve Java performance?
What are common Java coding best practices?
Explain SOLID principles in Java.
What are common Java interview coding questions?
How do you debug Java applications?
What are JVM arguments?
What are JVM startup options?
Explain Java execution flow from source code to bytecode.
Explain the class loading process in Java.
What are ClassLoaders?
What is Bootstrap ClassLoader?
What is Extension ClassLoader?
What is Application ClassLoader?
What is dynamic class loading?
How do you prevent object creation?
What is Singleton class?
How do you implement Singleton in Java?
What are immutable classes?
How do you create an immutable class?
What are design patterns commonly used in Java?
Explain Factory Pattern.
Explain Builder Pattern.
Explain Strategy Pattern.
Explain Observer Pattern.
What are Java 8 features?
What are Java 11 features?
What are Java 17 features?
What are Java 21 features?
What are the most frequently asked Core Java interview questions for experienced developers?
What is the Java Memory Model (JMM)?
Explain happens-before relationship in Java.
What is safe publication of objects?
What is escape analysis?
What is TLAB (Thread Local Allocation Buffer)?
What is object header in Java?
What is compressed OOPs?
How is memory allocated for objects?
What happens when new keyword is executed?
How does Java allocate arrays in memory?
What is class loading?
Explain the delegation model of ClassLoader.
What is custom ClassLoader?
When is a class initialized?
Difference between loading, linking, and initialization?
What is class unloading?
Can classes be unloaded from JVM?
What is static initialization order?
What is instance initialization block?
Execution order of constructors, static blocks, and instance blocks?
Difference between Comparable and Comparator?
How does compareTo() work?
How does Comparator chaining work?
What is natural ordering?
What is custom sorting?
What is immutable object?
Why should immutable classes be final?
Can immutable classes contain mutable fields?
How do you make defensive copies?
Advantages of immutable objects?
Difference between StringBuilder and StringBuffer?
Why is String immutable?
How is String Pool implemented?
Difference between new String() and string literal?
How does intern() work?
Can String Pool cause memory issues?
Explain hashCode() and equals() contract.
What happens if hashCode() is not overridden?
Can two unequal objects have same hashCode()?
Can equal objects have different hashCode()?
How do HashMap and equals() work together?
Explain finalize() deprecation.
What is Cleaner API?
What are Weak References?
What are Soft References?
What are Phantom References?
Difference between WeakHashMap and HashMap?
What are JVM memory regions?
Difference between Heap and Metaspace?
What is Eden Space?
What are Survivor Spaces?
What is Old Generation?
Explain Minor GC.
Explain Major GC.
Explain Full GC.
What causes Full GC?
How do you analyze GC logs?
Difference between Serial GC, Parallel GC, CMS, G1, ZGC, and Shenandoah?
What is G1 Garbage Collector?
What is ZGC?
What is Shenandoah GC?
When should you use Parallel GC?
Explain reflection with example.
What are drawbacks of Reflection?
How do you invoke methods using Reflection?
How do frameworks use Reflection?
Can private methods be invoked using Reflection?
What are annotations?
Difference between RetentionPolicy values?
What are meta-annotations?
How do custom annotations work?
What is @Inherited annotation?
Difference between checked and unchecked exceptions?
Can overridden methods throw broader exceptions?
Can constructors throw exceptions?
How does exception propagation work?
Best practices for exception handling?
What is serialization?
How does Serializable work internally?
What is serialVersionUID?
What happens if serialVersionUID changes?
What is Externalizable?
Difference between Serializable and Externalizable?
Explain transient keyword.
Explain volatile keyword.
Difference between transient and volatile?
What are lambda expressions?
How are lambda expressions implemented internally?
What is invokedynamic?
Difference between lambda and anonymous class?
What is functional interface?
Explain Optional class.
Difference between orElse() and orElseGet()?
What is Optional.flatMap()?
Common mistakes while using Optional?
Explain Java Streams.
Difference between map() and flatMap()?
Difference between filter() and peek()?
Difference between limit() and skip()?
Difference between findAny() and findFirst()?
Difference between reduce() and collect()?
What is Collector?
How does parallelStream() work?
When should parallel streams be avoided?
Explain var keyword.
What are records?
What are sealed classes?
What are text blocks?
Explain pattern matching in Java.
What are switch expressions?
What are modules in Java?
Explain module-info.java.
Benefits of Java Modules?
What is Process API?
What is VarHandle?
What is MethodHandle?
Difference between Reflection and MethodHandle?
Explain JVM architecture.
How does JIT compiler work?
What is HotSpot JVM?
What is C1 and C2 compiler?
What is GraalVM?
How do you troubleshoot OutOfMemoryError?
How do you analyze heap dumps?
How do you identify memory leaks?
How do you profile Java applications?
What tools do you use for JVM monitoring?
Difference between fail-fast and fail-safe iterators?
How does ConcurrentModificationException occur?
What is modCount?
Explain Java coding best practices.
What are common Core Java interview coding questions?
What are common Java performance tuning techniques?
What are common Java design mistakes?
What are the most frequently asked Core Java interview questions for 10+ years experienced developers?
What is Object-Oriented Programming, and what problems does it solve?
What are the four fundamental principles of OOP?
What is the difference between a class and an object?
What is encapsulation, and why is it important?
How do you achieve encapsulation in Java?
What is abstraction, and how is it different from encapsulation?
How do abstract classes support abstraction?
How do interfaces support abstraction?
What is inheritance, and why is it used?
What are the different types of inheritance?
Why does Java not support multiple inheritance through classes?
How can Java achieve multiple inheritance using interfaces?
What is polymorphism?
What is compile-time polymorphism?
What is runtime polymorphism?
What is method overloading?
What is method overriding?
What is the difference between method overloading and method overriding?
Can a static method be overridden?
Can a private method be overridden?
Can a final method be overridden?
What is dynamic method dispatch?
What is upcasting in OOP?
What is downcasting, and what risks are associated with it?
What is the difference between IS-A and HAS-A relationships?
What is composition?
What is aggregation?
What is the difference between composition and aggregation?
Why is composition often preferred over inheritance?
What is association in OOP?
What is dependency in object-oriented design?
What is object coupling?
What is cohesion?
Why should high cohesion and low coupling be preferred?
What is an immutable object?
How do you design an immutable class in Java?
Why is String immutable in Java?
What is the role of constructors in object creation?
Can constructors be inherited or overridden?
What is constructor chaining?
What is the difference between this and super?
What is the difference between an abstract class and an interface?
When would you choose an abstract class over an interface?
When would you choose composition over inheritance?
What is the Open/Closed Principle?
What is the Single Responsibility Principle?
What is the Liskov Substitution Principle?
What is the Interface Segregation Principle?
What is the Dependency Inversion Principle?
How do SOLID principles improve object-oriented design?
What is the difference between abstraction and polymorphism?
How does encapsulation improve maintainability?
How does inheritance affect coupling?
What are the disadvantages of excessive inheritance?
What is the fragile base class problem?
What is the diamond problem in multiple inheritance?
How does Java resolve default method conflicts in interfaces?
What happens when two interfaces contain the same default method?
What is the difference between an object reference and an object?
What happens internally when an object is created using new?
What is object identity versus object equality?
What is the contract between equals() and hashCode()?
Why should equals() and hashCode() be overridden together?
What is shallow copying?
What is deep copying?
How does cloning relate to OOP design?
What is an interface in Java?
What is an abstract class in Java?
What is the difference between an interface and an abstract class?
When should you use an interface instead of an abstract class?
When should you use an abstract class instead of an interface?
Can an interface contain concrete methods?
What are default methods in interfaces?
What are static methods in interfaces?
Can an interface have private methods?
Can an interface have constructors?
Can an abstract class have constructors?
Can an abstract class contain both abstract and concrete methods?
Can an abstract class contain instance variables?
Can an interface contain variables?
Why are interface variables implicitly public, static, and final?
Can an interface extend another interface?
Can an interface extend multiple interfaces?
Can an abstract class implement an interface?
Can an abstract class extend another abstract class?
Can a concrete class extend an abstract class and implement an interface?
Can a class implement multiple interfaces?
Why does Java support multiple inheritance through interfaces?
What is the diamond problem with interfaces?
How does Java resolve conflicting default methods?
What happens when two interfaces provide the same default method?
Can a class override a default method from an interface?
Can an interface extend an interface containing default methods?
Can an abstract class implement an interface without implementing all methods?
What happens if a concrete class does not implement all interface methods?
Can an interface contain abstract methods without the abstract keyword?
Are interface methods public by default?
What is the visibility requirement when implementing an interface method?
Can an interface method be protected or private?
Can an abstract class method be private?
Can an abstract method be static?
Can an abstract method be final?
Can an abstract class be final?
Can an interface be final?
Can an interface be instantiated?
Can an abstract class be instantiated?
Can an interface reference point to an implementing class object?
What is interface-based programming?
How does programming to an interface reduce coupling?
How do interfaces support polymorphism?
How does an abstract class support code reuse?
What is the difference between abstraction and implementation hiding?
How do interfaces help achieve loose coupling?
How do interfaces support dependency inversion?
How are interfaces used with dependency injection in Spring?
What is a functional interface?
What is the purpose of the @FunctionalInterface annotation?
Can a functional interface contain default and static methods?
Can a functional interface extend another interface?
What happens if a functional interface contains two abstract methods?
What is a marker interface?
What are examples of marker interfaces in Java?
What is the difference between a marker interface and an annotation?
What is a sealed interface?
What is a sealed abstract class?
How do sealed classes and interfaces control inheritance?
What is the difference between sealed, non-sealed, and final classes?
Can an interface extend a sealed interface?
Can an abstract class implement a sealed interface?
How would you design an extensible API using interfaces?
How would you design a common base workflow using an abstract class?
How does the Template Method pattern relate to abstract classes?
Why are interfaces commonly preferred for contracts?
What are the limitations of abstract classes?
What are the limitations of interfaces?
How have interfaces evolved from Java 7 to Java 8, 9, 11, 17, and 21?
What changed for interfaces in Java 8?
What changed for interfaces in Java 9?
Can an interface have private methods in modern Java?
Can an interface have static initialization blocks?
Can an abstract class contain static methods and variables?
Can an abstract class implement multiple interfaces?
Can an interface inherit methods from Object?
Can an interface override equals(), hashCode(), or toString()?
What happens if an interface declares a default method with the same signature as Object?
How does method resolution work between superclass and interface default methods?
What happens when a superclass and interface provide methods with the same signature?
Can two unrelated interfaces have methods with the same name and parameters?
How does Java handle covariant return types in interface implementations?
Can an interface method throw checked exceptions?
Can an implementing class reduce the checked exceptions declared by an interface method?
Can an implementing class change the return type of an interface method?
What is the difference between inheritance and interface implementation?
What is the difference between extends and implements?
Can a class extend one class and implement multiple interfaces?
Can an interface inherit state from another interface?
How would you migrate an abstract class design to interfaces?
How do interfaces improve testability and mocking?
When can excessive use of interfaces become a design problem?
How would you choose between interface, abstract class, and concrete class in a real project?

Related Topics