@UPPCLLKO There is no electricity since 3 hours in Unity City Kalyanpur Area. Could you please let us know when we will get the electricity so that we can sleep peacefully.
#uppcl@CMOfficeUP
240 CORE JAVA INTERVIEW QUESTIONS AND ANSWERS 👇
If you are preparing for a Java interview, this PDF with 240 core Java interview questions and answers will help you! Covering topics like static blocks, method overriding, encapsulation, and more, it’s a valuable resource to boost your confidence and skills.
To get the link 👇
1- Follow (so I can DM you)
2- Like & Repost to help others
3- Reply Interview for the pdf
Note: I’ll list this resources in a thread later 👇
#java #interview
Your public API is a hit. Hundreds of developers are building apps on top of it.
Six months later, you realize you need to change a field name in your response.
A breaking change. If you just deploy it, you'll break every single app that depends on your API.
What do you do? 🧵
Different Ways to Handle Configs in Your App
1.Environment Variables
- DB_URL=...
✅ Great for secrets and Docker/K8s
❌ Can get messy at scale
2.Config Files
- application.yml, .env, config.json
✅ Organized, version-controlled
❌ Don’t commit secrets
3.Spring Profiles / Environments
- application-dev.yml, application-prod.yml
✅ Auto-switch based on profile
❌ Easy to forget switching
4.Feature Flags
- Toggle behavior via flags (e.g., LaunchDarkly)
✅ Enable/disable features without redeploy
❌ Adds logic complexity
5.Centralized Config Server
- Spring Cloud Config, Consul, etc.
✅ Dynamic config updates across services
❌ Requires setup + extra infra
Spring annotations you MUST KNOW before going for a Java interview -
- @ Qualifier
- @ Async
- @ RestController vs @ Controller
- @ Condtional
- @ transactional
Very common Java Interview Question (Thread Alternation)
Ques: How do you make two threads print like this: 1 A 2 B 3 C...?"
(Thread 1 prints numbers, Thread 2 prints letters)
Most candidates mess this up by using sleep() or incorrect locking.
But What Interviewers like to hear 👇
“Used a shared monitor object and condition variable”
“Handled spurious wakeups with while loop”
“Used wait/notify for proper thread communication”
“Could also use ReentrantLock + Condition for more control”
Can you write down the correct code?
Another Common Springboot Interview :
Q: How do you implement graceful shutdown in Spring Boot?
Ans : Spring Boot (from v2.3+) supports graceful shutdown using the config:
server.shutdown=graceful
spring.lifecycle.timeout-per-shutdown-phase=30s
This ensures Spring waits for active requests to complete before shutting down the app.
To clean up resources (Kafka consumers, DB connections, thread pools), use:
@ PreDestroy on beans
Implement DisposableBean or SmartLifecycle
Override close() for custom beans
You can say something like this to sound experienced:
"We observed that without proper shutdown, some Kafka offsets weren't committed, leading to duplicate processing. After enabling graceful shutdown and handling bean lifecycle correctly, the issue was resolved."
Very very common interview question:
How do you implement circuit breaking in Spring Boot?
Start your answer with:
Used Resilience4j with Spring Boot , also mention annotations like @ CircuitBreaker, @ Retry, @ RateLimiter, and @ Bulkhead
Configure thresholds in application.yml.
Can also add this: “We used @ CircuitBreaker with fallback methods on external API calls. Integrated with Prometheus to monitor open/closed state.”
Also Mention fallback cache or async retry mechanism