Interview Q&A / Java

INTERVIEW Q&A · 72 QUESTIONS

Java interview questions

Collections, the JVM, strings, exceptions and threads, the backbone of most campus placement rounds.

  1. What does a Java method return when both try and finally contain a return?

    The finally block runs before the method actually returns, and a return inside finally overrides the earlier one, so the finally value wins. If finally only changes a variable, a primitive value already chosen for return is not affected.

    IntermediateQuick answer1 min read