Java and Spring Boot dominate the backend stack at Indian service IT companies (TCS, Infosys, Wipro, Cognizant) and a large proportion of Indian product companies in BFSI, enterprise SaaS, and e-commerce. This guide covers the Java and Spring Boot questions asked across experience levels at Indian companies.
Core Java Fundamentals
Fundamentals tested at every level: OOP principles: Abstraction (hiding implementation via interfaces), Encapsulation (private fields + public methods), Inheritance (extends), Polymorphism (method overriding at runtime). Collections framework: HashMap internals (hashCode, equals, load factor, rehashing), ArrayList vs LinkedList, ConcurrentHashMap vs synchronized HashMap. Generics and type erasure. Exception hierarchy: Checked (IOException, SQLException: must handle) vs Unchecked (RuntimeException: optional). Java 8+ features: Streams, lambda expressions, Optional, functional interfaces (Predicate, Function, Consumer, Supplier), CompletableFuture. String immutability and String pool. equals() vs == distinction.
Spring Boot Essentials
Spring Boot interview questions cover both configuration and concepts. Key annotations: @SpringBootApplication (combines @Configuration, @EnableAutoConfiguration, @ComponentScan), @RestController, @Service, @Repository, @Component, @Autowired, @Bean, @Configuration. Auto-configuration: Spring Boot auto-configures based on classpath: @ConditionalOnClass, @ConditionalOnProperty mechanisms. Dependency Injection: Constructor injection (preferred for required dependencies) vs field injection via @Autowired (not recommended). Application properties: application.properties vs application.yml, profile-specific configs (application-dev.yml). Actuator: /actuator/health, /actuator/metrics, /actuator/info: production monitoring endpoints.
REST APIs and JPA/Hibernate
REST API design with Spring MVC: @GetMapping, @PostMapping, @PutMapping, @DeleteMapping, @PathVariable, @RequestParam, @RequestBody. ResponseEntity for controlling status codes. Exception handling: @ControllerAdvice + @ExceptionHandler for global exception handling. JPA and Hibernate: Entity mapping (@Entity, @Table, @Id, @GeneratedValue, @Column). Relationships: @OneToMany (lazy loading by default), @ManyToOne, @ManyToMany. FetchType: LAZY (load on access) vs EAGER (load immediately): the N+1 problem and how JOIN FETCH or @EntityGraph solve it. JPQL vs native queries. Transaction management: @Transactional, propagation levels, rollback rules.
Java interviews test both syntax and system design thinking. Practise explaining multithreading and Spring architecture with HireStepX.
Practice freeMultithreading and Microservices
Multithreading: Thread creation (extending Thread vs implementing Runnable vs Callable + Future). Executor framework: ThreadPoolExecutor, Executors.newFixedThreadPool(). Synchronization: synchronized blocks, ReentrantLock, volatile keyword. ConcurrentHashMap vs HashMap in multithreaded contexts. Common problems: deadlock, livelock, race conditions. Microservices with Spring Boot: Service discovery with Eureka or Consul. API gateway: Spring Cloud Gateway. Circuit breaker: Resilience4j (@CircuitBreaker annotation). Feign client for declarative REST calls. Distributed tracing with Zipkin. Config server: centralised configuration with Spring Cloud Config. These Spring Cloud topics appear at senior and architect levels.
Frequently asked questions
Practice these questions on HireStepX