Top 30 Advanced Java Interview Questions for Experienced Developers

Hello guys, I have shared a lot of questions from Java Interviews in this article, so much so that many of my reader search Javarevisited for any Java interview question they come across. While In the past, I have shared Java concurrency questions, Java collections questions, Java questions on design patterns, and many tricky Java questions but a lot of people asked me to share more practical questions for experienced Java developers. Means, more advanced Java questions for 5 to 7 and even 10 years of experienced Java developers. 

So, in this article you will find questions from java profiling, garbage collection tuning, java memory management interview questions, how to deal with performance issues in Java web application, GC and performance tuning questions, monitoring performance of Java application and some JVM internals questions. 

While I have not given answers, I have given hints for many questions so that you can practice and answer them yourself. If you want me to check your answer then please post in comments and I will check and provide feedback as well. 


30 Advanced Java Interview questions for 5 to 7 Years Experienced Programmers

Without wasting anymore of your time, here is a list of my favorite advanced Java questions related to debugging, profiling, coding, performance improvement and on many practical topics which only a senior Java developer can be familiar. 


1) How do you measure execution time of a code or method in Java?

hint, - you can use System.nanoTime() or System.currentTimeInMillis() method to track start time and end time and then calculate difference.


2) What are the tools to profile a Java application?

You can use profilers like JProbe, YourKit, as well NetBeans profiler to profile your Java application. 


3) What do you mean by latency and throughput of Java application?

Latency is time related like how much time it take to do certain task like sending order to exchange and throughput is about how many orders you can do per second, minute or hours. Generally speaking, low latency and high throughput is desired in Java application for better performance. 


4) How do you measure latency and throughput of Java program?

hint - by tracking time it take to complete certain task. 


5) What are some common problem performance areas in Java web application?


6) How do you find the time spent in Garabage collection by your application?


7) How do you deal with OutOfMemoyrError in Java?


8) How do you deal with NoClassDefFoundError in Java?


9) What is the maximum memory you can provide to a 32-bit JVM?


10) What is difference between serial and parallel garbage collector?


11) How do you take thread dump in Java?


12) How do you take heap dump in Java?


13) How do you find the Java application listening on a particular port?


14) How do you find all the files hold by your Java application?


15) Your Java application is running very slow, what would be your strategy to find and solve the problem?


16) Your Java web application is running on tomcat and suddenly it become slow? What do you check?

disk space, OutOfMemory, DeadLock


17) What is difference between deadlock and race condition?


18) What is difference between 32-bit and 64-bit JVM? (answer)


17) What does -XX:CompressedOops JVM option does?


18) How do you increase memory of Java application?


19) How do you deal with java.lang.OutOfMemoryEror: PermGenSpace?


20) Can you explain structure of Java Heap Memory? (answer

Here is heap memory structure in Java before and after Java 8


Top 30 Advanced Java Interview Questions for Experienced Developers



21) What are some JVM option to enable Garbage collection logging in Java application?


22) What is file descriptor? Why it's important to close the file properly?


23) How logging affect performance of Java application?


24) What is Asynchronous logging? advantage and disadvantage?


25) How do measure memory and CPU profile of Java application? (example)


26) What is difference between Web and application Server? (Answer)


27) Can you debug tomcat?

Yes, why not, if you have source code you can easily debug Tomcat as its a Java application. 


28) How do you remote debug Java application?

hint, you can use IDEs like Eclipse and IntelliJ IDEA to remote debug a Java application, here is a complete guide to remote debug a Java application in Eclipse


29) How does concurrency affects performance of Java application?

hint - think parallelism, performance improvement and issues caused by poor concurrent programming like deadlock, race conditions etc.


30) How do you improve scalability of Java application?

hint - think about horizontal vs vertical scalability

That's all about 30 Advanced Java Interview Questions for Experienced Developers. These questions really checks depth of your knowledge about Java application and how to troubleshoot performance issues, debug Java application, as well as things like logging, System architecture, application support and other stuff on which an experienced Java developer is involved.  

So, far I have not provided the answer of questions so that people can answer in comments but if need answer of any of these questions then feel free to ask in comments and I will add the answers. 


No comments:

Post a Comment

Feel free to comment, ask questions if you have any doubt.