Hero Image
- Mihai Surdeanu

(#7) Tricky Java Questions for Interviews

Motto: Keep in mind - try to reduce memory consumption of your application!

Q1: Think about some real use-cases when a blocking queue can be used in practice. Can you give one example of implementation for a blocking queue?

Q2: In which situation a CopyOnWriteArrayList is preferred against another concurrent implementation of a list?

Q3: Reduce memory footprint for the following class:

public class MyPersonalCar {
    private Boolean inService = false;
    private long age = 10; // in years
    private LocalDate acquisitionDate = LocalDate.of(2010, 11, 23);

By the way, can you specify how many bytes were saved after implementing all changes suggested?

Other Related Posts:


Blog Comments powered by Disqus.