-
Notifications
You must be signed in to change notification settings - Fork 0
Java
Raymond Cheung edited this page Dec 4, 2024
·
16 revisions
Java Questions
- Object-Oriented Programming
- What are the differences between Abstract Class and Interface?
- What is the anonymous class? Why use it?
- What are Object methods?
- What are the differences between overriding and overloading?
- Can the method signature of overloading differ by only return type?
- What are the modifiers?
- What are value types and reference types?
- What is the static keyword?
- What is the final keyword?
- What is the finally keyword? When the finally block can't be executed?
- What are the differences among these keywords: final, finally, finalize?
- What is Hash Code?
- How does equals() work?
- What's the difference between == and equals()?
- Are two Strings with the same value ==?
- Are two Integers with the same value ==?
- What are the rules to follow when implementing hashCode()?
- What's the difference between == and hash in Java?
- What is singleton and when would you want to use it?
- What are the different ways to implement a singleton in code?
- What are the differences between new and getInstance()?
- How to create immutable objects?
- Why is string immutable and reference type?
- What are the advantages of immutable objects?
- How does clone() work?
- Can Integer be cast as an Object? If so, any problems?
- How does classloader work in Java?
- What is JVM?
- What is Garbage Collection?
- How does the garbage collector work in Java?
- How many types of garbage collectors are there? What is G1? What is ZGC?
- What are GC roots, and what are they used for? Explain the different types of GC roots in Java.
- What is the Spring Framework?
- Spring JPA vs JDBC Template
- What is multithreading?
- What is a synchronized modifier?
- What are the problems of threading and synchronization?
- What is volatile? Does volatile guarantee synchronization?
- What is ThreadLocal? How does it differ from volatile?
- How can you declare a thread?
- What are the differences between Thread and Runnable?
- What is a deadlock? How can you avoid it?
- What is a race condition?
- What are async and await? Why use asynchronous programming? What are the disadvantages?
- What is AtomicInteger? How does it work behind the scenes? What is CAS (Compare-And-Swap)?
- How would you synchronize access to a variable in the following scenarios:
- Single writer and multiple readers?
- Multiple writers and multiple readers?
- Multiple writers and a single reader?
- What is the difference between concurrency and parallelism?
- What are I/O-bound tasks vs. CPU-bound tasks?
- What are the differences between HashMap and Hashtable?
- How does HashMap work?
- How to implement a HashMap?
- How are hashCode() and equals() methods related to map/set?
- What happens when you call a put() method on a map/set?
- What happens when you call a get() method on a map/set?
- How to return keys of HashMap in order?
- What are the differences between LinkedList and ArrayList?
- What is the difference between a single and a double linked list?
- How to implement a Stack?
- How to avoid a memory leak from a Stack?
- Apart from HashSet, what are other Set implementations?
- What is TreeSet? When to use it?
- What's the difference between ConcurrentHashMap, HashMap, and SynchronizedMap?
- What are the pros and cons of these data structures?
- What's CopyOnWriteList?
- Any data structures with built-in sorting?
- What is the sorting algorithm? What are its time and space complexities?
- What is the difference between heap and stack memory in Java? What types of objects are in them?
- What is the difference between memory models of Java 8 and 21?
- What are the differences among Strong, Weak, Soft, and Phantom references?
- What is Closeable in Java?
- What interface to implement and method(s) to code in your class for Closeable?