Nagarro Java Professional Interview Preparation Guide
Java Core Questions
1. What is the difference between == and .equals() in Java?
- '==' compares references, '.equals()' compares values.
2. OOPS Principles in Java?
- Encapsulation, Abstraction, Inheritance, Polymorphism
3. Multithreading and Thread Safety?
- Use synchronization, locks, or thread-safe collections.
Spring Framework Questions
1. Spring Boot vs Spring MVC?
- Boot simplifies setup with embedded servers; MVC is the traditional framework.
2. Securing REST APIs?
- Use Spring Security with JWT/OAuth2 and annotations like @PreAuthorize.
3. Dependency Injection Types?
- Constructor, Setter, Field (least recommended).
Microservices & Cloud
1. Communication?
- REST, gRPC, message queues.
2. Challenges?
Nagarro Java Professional Interview Preparation Guide
- Discovery, logging, circuit breakers, consistency.
3. Docker vs Kubernetes?
- Docker: containerization. Kubernetes: orchestration and scaling.
Frontend (React/Angular)
1. React vs Angular?
- React: Library, JSX, one-way binding.
- Angular: Framework, TypeScript, two-way binding.
2. Components?
- Encapsulated logic and UI.
DevOps Tools
1. Maven vs Gradle?
- Maven: XML, mature. Gradle: Groovy/Kotlin, faster builds.
2. Jenkins vs GitLab CI?
- Jenkins: Plugin-based. GitLab CI: Git-integrated.
Coding Questions
1. First Non-Repeating Character
- Use LinkedHashMap to count and preserve order.
2. Thread-Safe Singleton
Nagarro Java Professional Interview Preparation Guide
- Double-checked locking with volatile.
3. REST Controller
@RestController, @GetMapping used to return JSON response.
4. React Counter Component
- useState hook to handle count.
5. Dockerfile for Spring Boot
FROM openjdk:17
COPY target/app.jar app.jar
ENTRYPOINT ["java", "-jar", "/app.jar"]