Interview prep

Java interview questions

Core Java, collections, multithreading, the JVM and Java 8+ features — the questions backend interviews actually ask. Practise free with instant feedback, then test yourself in a timed exam.

Sample Java questions

  1. Q1Medium

    What does LinkedHashMap accessOrder=true change?

    • A It links entries in access order
    • B It prevents removals
    • C It disables hashing
    • D It sorts keys alphabetically
  2. Q2Medium

    Which Set operation keeps only elements present in both sets?

    • A intersectOnly()
    • B common()
    • C keepBoth()
    • D retainAll()
  3. Q3Medium

    Which method creates a reversed view/order comparator from an existing Comparator?

    • A reverseComparatorOnly()
    • B reversed()
    • C backward()
    • D invertSort()
  4. Q4Medium

    What does Collections.binarySearch require for meaningful results on a list?

    • A The list must contain no duplicates
    • B The list must be immutable
    • C The list must be sorted according to the same ordering
    • D The list must be a Set
  5. Q5Medium

    What is a common safe way to compare two int values in a Comparator?

    • A a - b always
    • B Integer.compare(a,b)
    • C a.equals(b)
    • D String.valueOf(a).compareTo(String.valueOf(b))

Answers and explanations appear as you practise — take the free quiz to check yours.

Java courses on IntQues

More interview topics

Open WhatsApp chat