Core Java - Level V (Expert)
Practice 50 Core Java - Level V (Expert) interview questions with detailed answers. Part of the Core Java track on Java Interview Hub.
- You are developing an application that loads plugins from third-party sources. How would you ensure system security while using these plugins?
- During a code review, you find a ConcurrentModificationException caused by modifying a list while iterating over it in a multi-threaded environment. How would you refactor this code?
- Your application has memory leaks due to improper handling of cache objects. How would you optimize memory management using L1 and L2 garbage collection?
- How would you design a Java application that needs to handle concurrent access to a shared resource?
- Explain how the ConcurrentHashMap works in Java and its advantages over Hashtable.
- How would you diagnose and solve thread starvation and deadlock issues?
- How would you use Java 9’s module system to modularize a monolithic Java application?
- Can you implement a thread-safe Singleton pattern without synchronization?
- Design a multi-threaded application scenario where avoiding deadlock is critical.
- How would you explain the role of JRE and JVM in reducing the memory footprint of a Java application?
- How would you analyze and address OutOfMemoryErrors in your application logs?
- How do default methods in interfaces affect the backward compatibility of a Java application?
- What are dynamic proxies in Java, and how can they be used?
- Explain shallow copy vs deep copy in the context of Java cloning.
- How would you implement a thread-safe HashMap without using ConcurrentHashMap?
- How would you implement a deep copy in Java?
- How would you diagnose and ease debugging problems when a user clicks on a button and gets a NullPointerException?
- What are the disadvantages of JIT compilation and in what scenarios might you consider disabling JIT compilation?
- How would correctly implementing equals() and hashCode() affect the performance and accuracy of your caching mechanism in a high-traffic web application?
- How many threads will open for parallel streams and how does parallel stream internally work?
- How does Executor check the number of active or dead threads, and what is the internal working of the thread pool executor?
- What changes occurred in JDK 8 related to PermGen and Meta?
- What is the difference between normal REST services and RESTful Web Services?
- What is a DDOS (Denial of Service) attack, and how can it be prevented in applications?
- What is the difference between CountDownLatch and CyclicBarrier, and when would you use each?
- How does the introduction of the module system in Java 9 impact application architecture?
- What are the major changes in Java 9, and how do they affect your application development process?
- How would you analyze and fix a memory leak in a Java application?
- Describe the Java Reflection API and its use cases.
- You need to design a class that cannot be extended or modified. How would you implement this using the final keyword?
- How would you use reflection to implement a simple dependency injection framework?
- How would you refactor a piece of non-thread-safe code to make it thread-safe using synchronization?
- Can you change a final field using reflection?
- How have recent updates in Java (like records, sealed classes) impacted object-oriented programming principles?
- How would you design a system that supports different payment methods (credit card, PayPal, cryptocurrencies) using interfaces and abstract classes?
- Describe a scenario where a functional interface was the best solution.
- How would you analyze and debug memory leaks in Java?
- Discuss scenarios where the final keyword significantly impacts the design of a Java program.
- How would you explain the role of JVM in running a simple Java program to new developers?
- Can you explain all garbage collectors up to Java's latest stable release?
- What are the default garbage collectors in different Java versions?
- What performance optimizations have you done in your Java project?
- What is a hidden class, introduced in Java 15, and its usage?
- Difference between visibility and atomicity in multithreading?
- Explain the internal working of ThreadPoolExecutor and how it manages tasks in its different states.
- Can you describe the process of how memory is allocated in the heap and whether the heap size is fixed?
- How would you structure your code to avoid memory leaks in a long-running application?
- How do you create a high-performance system that requires minimal garbage collection?
- How would you improve the scalability and memory efficiency of a large Java application?
- How does the latest Java module system impact large-scale enterprise applications?