Top 30 Java Entry Level Interview Questions and Answers

In this post, I will be sharing the top 30 java entry level interview questions and answers. If you are looking for placement in one of the top services companies like TCS, Wipro, Accenture, Infosys, Cognizant, etc. then you have landed in the right place. Let's dive deep into the interview questions.

Read Also: Java Interview Questions for Experienced

Q1 What are the main features of Java?

a.  Java is an Object-Oriented programming language
b.  Simple
c.  Distributed
d.  Java support Multithread
e.  Java is a Platform independent programming language
f.  Java is more secured than other languages
g.  Portable
h.  Robust

Q2 What is an Array?

The collection of similar data types is known as Array. You can find it in detail here.

Q3 Is it possible to declare an Array without Array size?

It is not possible to declare an Array without Array size. If you try to do so then you will get compile-time error.

Q4 What do you understand by the term Object-Oriented Programming language? 

The object-oriented programming language is a language that uses objects in programming.

Q5 What are the basic principles of the OOPs concept?

a. Abstraction
b. Polymorphism
c. Encapsulation
d. Inheritance

Q6. What is the abstraction in java?

Abstraction means hiding the detailed information from the user. Abstraction can be achieved by interfaces and abstract classes.

Q7 What do you mean by inheritance in java?

Inheritance is the main feature of java. Inheritance means java class or interface can inherit the properties and behavior from another class or interface. Inheritance can be gained by implementing interfaces or extending classes. You can find it in detail here.

Q8 What do you mean by the Object in java?

The object is the instance of a class. A class contains the basic properties and behavior of a real-world object. We can instantiate this class with a new keyword to make an object.
For example, Animal.java has a class named Animal. Animal animal = new Animal() is an object or instance of this class.

Q9 What is a constructor?

Java provides the facility to declare a special member of the class with the same name, no return type, and with zero or many parameters is called a constructor.

Q10 What is polymorphism in java?

Poly means many and Morph means forms of a method or constructor or operator. So finally, Polymorphism means many forms of the same method or constructor or operators. You can find it in detail here.

Q11 What do you mean by the method overloading?

The method with the same name but the number of arguments are different is called method overloading. Methods return type should be the same for all methods. You can find it in detail here.

Q12 What do you mean by the method overriding in java?

You can find the details about method overriding here.

Q13 Does java support multiple inheritance?

Java classes do not support multiple inheritance but can gain multiple inheritance by using the interfaces.

Q14 Describe constructor vs method?

The constructor is the special member of the class with the same name as the class and no return type. But the method is the ordinary member of a class used to describe the behavior of some object or class.

Q15 Is it possible to overload the main() method?

Yes, the main method can be overloaded. But we should declare original one like public static void main(String args[]){} because JVM will look for this when starting execution.

Q16 What is the difference between String, StringBuilder and StringBuffer?

You can find the answer in detail here.

Q17 What is the difference between Collection and Collections.

The difference between Collection and Collections you can find it in detail here.

Q18 What is multithreaded programming?

Multithreaded means multiple threads will run to execute the task simultaneously.  It's important in the programming world. The operating system is an example of a multithreaded system.

Q19 What is the difference between Error and Exception?

Error is generated by the environment at runtime. The exception is generated by the application intentionally or mistakenly. An exception can be checked or unchecked, but the error is only unchecked. You can find the difference between Error and Exception here.

Q20 Difference between static and non-static methods?

Static methods belong to a class but non-static methods belong to an object. You don’t need to instantiate a class to access the static methods, but you have to instantiate the class to get access to non-static methods.

Q21 Difference between method overloading and method overriding?

You can find the difference between method overloading and method overriding here.

Q22 What are the different ways to create threads in java?

There are two ways to create threads in java. Ways are listed below:
a. Implement Runnable interface
b. By extending Thread class

Q23 What is the synchronization in java?

Synchronization is a technique to control access of a method with multiple threads at the same time. If we declare a method synchronized, then only one thread can use this method at a time. This is basically used for Thread safety. You can find it in detail here.

Q24 What is the use of the final keyword?

We cannot change the value of a final variable. We are not able to inherit a final class and cannot override a final method.

Q25 What is the garbage collection of java?

To clean the object from memory which has no reference is called garbage collection. It’s an important feature of java. Java automatically clears the objects from memory. We don’t need to clean the object manually from memory.

Q26 What is the cloning in java?

Java cloning means create an exact copy of an object. Shallow or Deep cloning is used in java to clone a java object. The clone() method is used to clone an object. You can find the difference between Shallow and Deep cloning here.

Q27 What is JVM? 

Java virtual machine is called JVM. JVM compiles and interprets the java code. JVM manages the garbage collection mechanism and other things efficiently. JVM manages objects in heap memory.

Q28 What are the difference between final, finally and finalize in java?

The keyword final is used to make a class, variable, or methods final. Final classes cannot be inherited, variables value cannot be changed, and methods cannot be overridden.
The keyword finally used in the exception handler to clear some post-task after the execution of try or catch block.
The finalize keyword used to clean up some tasks before the object is removed from memory. The finalize method mainly used in garbage collection.
You can find it in detail here.

Q29 What is the difference between float and double datatypes?

You can find the answer in detail here.

Q30 Is it possible to override the overloaded method in java?

Yes, in java it is possible to override the overloaded method.

That's all for today. Please mention in comments in case you have any questions related to top 30 entry level interview questions and answers.

About The Author

Subham Mittal has worked in Oracle for 3 years .
For more java articles ,Click here to Subscribe JavaHungry