In the last post, we have discussed on Hadoop Interview Questions and now we are going to explain the most commonly asked Java Interview Questions for Job Seekers.
Java Interview Questions for Job Seekers
What is the difference between path and classpath variables?
PATH is an environment variable used by operating system to locate the executables. That’s why when we install Java or want any executable to be found by OS, we need to add the directory location in the PATH variable. If you work on Windows OS, read this post to learn how to setup PATH variable on Windows.
Classpath is specific to Java and used by java executables to locate class files. We can provide the classpath location while running java application and it can be a directory, ZIP files, JAR files etc.
Read more: Path Vs. ClassPath
What is the importance of the main method in Java?
main() method is the entry point of any standalone java application. The syntax of the main method is public static void main(String args).
the main method is public and static so that Java can access it without initializing the class. The input parameter is an array of String through which we can pass runtime arguments to the java program. Check this post to learn how to compile and run the java program.
Read more: Java Methods
What is overloading and overriding in java?
When we have more than one method with the same name in a single class but the arguments are different, then it is called as method overloading.
The overriding concept comes in the picture with inheritance when we have two methods with the same signature, one in the parent class and another in the child class. We can use @Override annotation in the child class overridden method to make sure if parent class method is changed, so as child class.
Read more: Overloading Vs. Overriding
What are different types of classloaders?
There are three types of built-in Class Loaders in Java:
- Bootstrap Class Loader – It loads JDK internal classes, typically loads rt.jar and other core classes.
- Extensions Class Loader – It loads classes from the JDK extensions directory, usually $JAVA_HOME/lib/ext directory.
- System Class Loader – It loads classes from the current classpath that can be set while invoking a program using -cp or -classpath command line options.
Java Compiler is stored in JDK, JRE or JVM?
The task of java compiler is to convert java program into bytecode, we have javac executable for that. So it must be stored in JDK, we don’t need it in JRE and JVM is just the specs.
Read more: JDK V.s JRE and JVM
Learning Java programming from the college first year itself will be useful to make your career ahead from others. Tutorial Chat provides FREE training and guides on Java Programming, DotNet, Hadoop, Big Data and more.
Subscribe Tutorial Chat and follow us on Twitter and Facebook by clicking the below links:
Also, don’t ever forget to share this post with your friends via WhatsApp groups!