Top 21 Java Final Modifier (Keyword) Interview Questions and Answers

The final modifier is one of the important keywords in Java. You can use this with a class, method, and variable as well. A good knowledge of final keyword is not only essential for writing good, performant and secure Java programs but also to clear any  Java interview. Interviewer pays special attention to final keyword and expects candidates knows how and when to use the final modifier with variables, methods, and classes. In this article, I have collected Java interview questions which are based upon the concept of final modifier. You might have seen many of these questions on both telephonic and face-to-face round. You can use this collection not only to check your knowledge about final keyword but also to prepare for final modifier from Java interview's perspective.  If you have come across any interesting final modifier question which is not in this list, please share with us as a comment and I'll add into this list.

3 Maven Eclipse Tips for Java Developers

If you are using Maven inside Eclipse IDE via M2Eclipse plugin then following tips can help you a lot.

1) Setup Dependency as Java Project in Eclipse
If your POM dependencies is another project in Eclipse then your project will automatically get updated whenever you build the dependent project. For example, let's say you have a project, ABC, which is dependent on two core modules e.g. framework.jar and persistence.jar, if you have checked out these project and has set up them as Maven Eclipse project, M2Eclipse can directly add them as dependency, instead of loading their JAR files from repository, be it local or remote.

How to Print all Leaf Nodes of Binary tree in Java - Recursion and Stack

Binary tree based questions are very common in Java or any other Programming job interviews. One of the frequently asked binary tree questions is "write a program to print all leaf nodes of a binary tree". In order to solve this problem, you must know what is a leaf node? A leaf node in a binary tree is a node whose left and right child is null. They are actually the last nodes of any binary tree. In a typical programming interview, you would be given a binary tree and asked to write a program to print all leaf nodes. Usually, all binary tree related questions can be solved easily using recursion because a tree is a recursive data structure, but you should also know how to solve them without recursion.