Top 50 Full Stack Java Developer Interview Questions and Answers
Full stack Java developer interviews cover both back-end (Java, Spring Boot, databases) and front-end (JavaScript frameworks) topics. Here are frequently asked questions across both areas.
Back-End (Java & Spring Boot)
1. What is dependency injection in Spring?
Dependency injection is a design pattern where objects receive their dependencies from an external source (the Spring container) rather than creating them directly, improving testability and decoupling.
2. What is the difference between @Component, @Service, and @Repository?
All three register a class as a Spring bean; @Service and @Repository are specialized forms of @Component used to indicate service-layer and persistence-layer roles respectively.
3. How do you handle exceptions globally in a Spring Boot REST API?
@RestControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(ResourceNotFoundException.class)
public ResponseEntity<String> handleNotFound(ResourceNotFoundException ex) {
return ResponseEntity.status(HttpStatus.NOT_FOUND).body(ex.getMessage());
}
}
4. What is JPA, and how does it relate to Hibernate?
JPA is a specification for object-relational mapping in Java; Hibernate is the most widely used implementation of that specification.
5. What is the difference between REST and SOAP?
REST is a lightweight architectural style using standard HTTP methods and typically JSON, while SOAP is a stricter protocol using XML with a formal contract.
Front-End
6. What is the difference between state and props in React?
Props are read-only data passed from a parent component, while state is data managed within a component that can change over time.
7. What is two-way data binding in Angular?
Two-way data binding automatically synchronizes data between the component class and the template, so changes in one are reflected in the other.
8. How do you make an API call in React?
useEffect(() => {
fetch("/api/users")
.then(res => res.json())
.then(data => setUsers(data));
}, []);
Full Stack Integration
9. How do you handle CORS issues between a React front end and a Spring Boot back end?
By configuring allowed origins on the Spring Boot side using @CrossOrigin or a global CORS configuration bean.
10. How would you design authentication for a full stack application?
A common approach is issuing a JWT token on login from the Spring Boot back end, which the front end stores and sends with each subsequent request for authentication.
Master Java with Uncodemy
Hands-on training, live projects, and placement support in our Java Programming Course.