Hero Image
- Mihai Surdeanu

(#9) Tricky Java Questions for Interviews

Motto: OOP, Optional and clean code...

Q1: Let’s suppose you have an Optional object. What’s the difference between calling orElseGet and orElse on it? Can you provide a concrete situation when orElseGet is much better?

Q2: Why Java is not 100% considered an object oriented programming language?

Q3: Why in Java is recommended to have methods with maximum 10 lines of code and in C is recommended to not have too many small methods due to stack call overhead? There is no performance issue in Java when you have too many small methods?

Other Related Posts:

Microbenchmarking with Java

Microbenchmarking with Java

Hello guys,

Today, we are going to continue the series of articles about Java ecosystem. More specific, today, we are going to talk about JMH (Java Microbenchmark Harness).

2nd Apr 2022 - Mihai Surdeanu