We are sharing the top 1000 Java interview questions , these questions are frequently asked by the recruiters. Java interview questions can be asked from any core java topic . So here we tried our best to provide you the java interview questions and answers for experienced which should be in your to do list before facing java questions in technical interview.
Java is one of the most popular programming language. There is a growing demand for Java Developer jobs in technology companies.This article contains technical interview questions that an interviewer asks for Java technology and related topics like Spring, Hibernate, Maven, Git, Microservices, AWS etc.
Once you go through them in the first pass, mark the questions that you could not answer by yourself. Then, in second pass go through only the difficult questions.
After going through this questions 2-3 times, you will be well prepared to face a technical interview for a Java Developer position from Software Engineer level to Principal Engineer level.
All the best!!
1. What is the difference between JDK and JRE?
JDK stands for Java Development Kit. It contains the tools and libraries for development of Java programs. It also contains compilers and debuggers needed to compile Java program,
JRE stands for Java Runtime Environment. This is included in JDK. JRE provides libraries and JVM that is required to run a Java program.
In Java, ClassLoader is a class that is used to load files in JVM. ClassLoader loads files from their physical file locations e.g. Filesystem, Network location etc.
There are three main types of ClassLoaders in Java.
1. Bootstrap ClassLoader: This is the first ClassLoader. It loads classes from rt.jar file.
2. Extension ClassLoader: It loads class files from jre/lib/ext location.
3. Application ClassLoader: This ClassLoader depends on CLASSPATH to find the location of class files. If you specify your jars in CLASSPATH, then this ClassLoader will load them.
8. Do you think ‘main’ used for main method is a keyword in Java?
No, main is just a name of method. There can be multiple methods with same name main in a class file. It is not a keyword in Java.
9. Can we write main method as public void static instead of public static void?
No, you cannot write it like this. Any method has to first specify the modifiers and then the return value. The order of modifiers can change.
We can write static public void main() instead of public static void main().
10. In Java, if we do not specify any value for local variables, then what will be the default value of the local variables?
Java does not initialize local variables with any default value. So these variables will be just null by default.
11. Let say, we run a java class without passing any arguments. What will be the value of String array of arguments in Main method?
By default, the value of String array of arguments is empty in Java. It is not null.
12. What is the difference between byte and char data types in Java?
Both byte and char are numeric data types in Java. They are used to represent numbers in a specific range.
Major difference between them is that a byte can store raw binary data where as a char stores characters or text data.
Usage of char is E.g. char ch = ‘x’; Byte values range from -128 to 127.
A byte is made of 8 bits. But a char is made of 16 bits. So it is equivalent to 2 bytes.
Recommended Posts
Top 1000 Java Interview Questions & Answers - Section II - OOPs ( Object Oriented Programming )
Top 1000 Java Interview Questions & Answers - Section III -Inheritance
Top 1000 Java Interview Questions & Answers - Section IV - Static
Top 1000 Java Interview Questions & Answers - Section V - Method Overloading and Overriding
Core Java Important Questions Part 1
Core Java Important Questions Part 2
Core Java Important Questions Part 3
Core Java Important Questions Part 4
Core Java Important Questions Part 5
Core Java Important Questions Part 6
Core Java Important Questions Part 7
Core Java Important Questions Part 8
Core Java Important Questions Part 9
Java Collections Interview Questions Part 1
Java Collections Interview Questions Part 2
Java Collections Interview Questions Part 3
Java MCQs with Answers Set III
If you have any doubts join the discussion below ,our Moderator will reply to your Queries