Mihai Surdeanu

(#5) Tricky Java Questions for Interviews

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.


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


Arhiva personală