Mihai Surdeanu

(#7) Tricky Java Questions for Interviews

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?

Mihai

Pasionat de IT. Pasionat de viață. Pasionat de tot ceea ce înseamnă a face o viață mai bună, plină de înțelegere, ajutor reciproc și iubire de aproape.

Adaugă comentariu

Arhive

Arhiva personală