Hero Image
- Mihai Surdeanu

(#5) Tricky Java Questions for Interviews

Motto: New stuff introduced in Java 8...

Q1: What's the output printed to console?

public static void main(String[] args) {
    System.out.println(null instanceof Object);
}

Q2: Why text files and binary files are separated in new Java NIO API? In theory, text files are represented also in binary format internally.

Q3: Which of the following statement is a best practice? Please select one or multiple options:

  1. Never pass null as value for a method parameter.
  2. Never pass Optional as value for a method parameter.
  3. In order to fail-fast, checks for null values should be done at Service Layer.

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