Summary of "Java Interview Questions 🔥 | Top 80 Most Asked | Core Java, Spring Boot, Microservices | 1–10 Yrs"
Summary — Java Interview Questions (Core Java, Spring Boot, Microservices, Multithreading)
Scope
A compact interview-prep walkthrough (PDF with ~100 questions) covering core Java fundamentals up to Spring Boot and microservices patterns for 1–10 years experience. The presenter references a Java interview playlist and separate deep-dive videos for many topics.
Key technical concepts & short explanations (answers / interview tips included)
1. JVM / JRE / JDK
- JDK: development kit (compiler, debugger, JRE, tools).
- JRE: runtime (libraries + JVM).
- JVM: executes bytecode, handles GC, memory, platform independence.
- Typical flow:
.java→javac→.class(bytecode) → JVM executes.
2. Class loader & parent delegation
- JVM subsystem that loads classes at runtime (Bootstrap, Extension/Platform, Application loaders).
- Parent-delegation improves security and prevents duplicate class loads.
3. Basic language items
System.out.println:Systemis a final class,outis a staticPrintStream,printlnis a method.public static void main(String[] args):public(visible),static(callable without an object),void(no return);argsare command-line parameters.
4. Spring Cloud Config / dynamic refresh
- Config Server (git-backed) + clients.
- Use
spring-cloud-config+@RefreshScope(and actuator/refresh) to reload properties at runtime without restart.
5. Memory leaks & OOM
- Common causes: unclosed resources, static references, listeners, wrong references.
- Fixes: close resources, use weak references, analyze heap dumps (jvisualvm, JProfiler, MAT), add logging/monitoring.
- Prefer try-with-resources over
finalize(deprecated).
6. OOP basics
- Four pillars: encapsulation, inheritance, polymorphism (overloading/overriding), abstraction.
- Interview tip: emphasize maintainability and reuse.
7. Exceptions
throwvsthrows.- Checked exceptions: compile-time enforced.
- Unchecked exceptions: runtime (
RuntimeException). - Best practices: custom exceptions, exception propagation, order multiple
catchblocks (child before parent), avoid swallowing exceptions — log and use global handlers. - Note
finally: executes for cleanup but can be affected if it itself throws.
8. Language specifics
final/finally/finalizedifferences.==vs.equals().- String immutability: reasons include security and caching (string pool).
transientprevents serialization of fields.- Marker interfaces:
Serializable,Cloneable.
9. Collections and concurrency
- HashMap internals: compute hash → bucket; resize doubles capacity at threshold; collisions handled via linked list, promoted to tree (red-black) when needed.
- Returning a constant
hashCodecauses collisions and severe performance degradation.
- Returning a constant
- ConcurrentHashMap: thread-safe alternative, no ConcurrentModificationException while iterating, finer-grained locking, disallows null keys.
- ArrayList vs LinkedList: ArrayList = dynamic array (fast random access); LinkedList = doubly-linked (cheaper insert/remove at ends).
- Comparable vs Comparator: Comparable = natural ordering (
compareTo); Comparator = custom/multi-field ordering (compare). - Thread-safe collections examples:
CopyOnWriteArrayList,ConcurrentHashMap.
10. Multithreading & concurrency constructs
- Creating threads: extend
Threadvs implementRunnable(preferRunnable);Callablereturns a value and can throw checked exceptions. - Synchronization:
synchronizedmethods/blocks, intrinsic vs explicit locks,volatilefor visibility. wait/notify/notifyAll(Object methods) vsThread.sleep.- Deadlock: causes and avoidance (lock ordering,
tryLock, avoid nested locks). - Executor framework / thread pools (
Executors.newFixedThreadPool), resource management.
11. Memory model & GC
- Stack vs Heap: stack per thread, heap shared.
- Metaspace replaced PermGen (Java 8+).
- Generational GC: young/old generations; minor vs major GC.
- Tools: heap dumps, jvisualvm, MAT, profilers; monitoring with Prometheus/Grafana.
12. Spring / Spring Boot essentials
- Spring Boot = auto-configuration + embedded server + starter dependencies.
- Use
@SpringBootApplication(component scan + enable auto-config + configuration). - Dependency Injection / IoC basics; bean stereotypes:
@Component,@Service,@Repository(@Repositoryadds DB exception translation). @Transactionalfor DB transaction management and rollback.- Controller vs
@RestController(@RestController=@Controller+@ResponseBody). - Global exception handling with
@ControllerAdviceand@ExceptionHandler.
13. Microservices fundamentals & patterns
- Service registry & discovery: Eureka.
- API Gateway: single entry point (routing, auth).
- Centralized config: Config Server.
- Circuit breaker (Resilience4j): open / half-open / closed states to prevent cascading failures and provide fallbacks.
- Feign client (preferred over
RestTemplate;RestTemplateis being deprecated). - Saga pattern for distributed transactions (choreography or orchestration).
- Security: OAuth2, JWT, API Gateway authentication.
- Asynchronous/event-driven patterns with Kafka; scalability: caching, load balancing, horizontal scaling.
14. JPA / Hibernate
- JPA = persistence API spec; Hibernate = a common implementation.
- Eager vs lazy loading.
- N+1 select problem (avoid with fetch-join / appropriate queries).
- Locking: optimistic (version-based) vs pessimistic (lock-based).
15. Production troubleshooting & best practices
- Instrumentation: logs, actuator endpoints, metrics, distributed tracing, Prometheus/Grafana.
- Operational fixes: graceful rollouts, hotfixes, circuit breakers, retries, caching, scaling, async patterns (Kafka), correct exception handling and HTTP status codes for REST APIs.
Resources & tutorial pointers mentioned
- PDF with ~100 Java interview questions (presenter’s resource).
- Channel playlist: Java interview course; individual videos for HashMap internals,
final/finally/finalize,==vsequals, and other deep dives. - Tools: jvisualvm, JProfiler, Eclipse MAT, Prometheus, Grafana.
- Contact / coaching: Topmate profile (presenter’s offered help).
Main speaker / sources
- The video presenter (channel owner) — refers to his Java interview playlist and prior “Namura Java interview questions” video.
- Content draws on standard Java / Spring / Spring Cloud, Netflix Eureka, Resilience4j, Feign, Kafka, JPA/Hibernate documentation and common industry practices.
Category
Technology
Share this summary
Is the summary off?
If you think the summary is inaccurate, you can reprocess it with the latest model.
Preparing reprocess...