Frequently Asked and Common Java Interview Questions and Answers

If you are looking for a career on Java and have already gone through several Java interviews then you are well accustomed with the most common interview questions.

Some Java questions are favourite of the recruiters and they keep on repeating in any interview.

On the other hand if you are a fresher appearing for your first interview then you need to know some of the frequently asked questions on Java interviews. Hashtable vs. HashMap, difference between equals, LinkedList vs. ArrayList are some of the most common Java interview questions.

Every Java employer, be he a fresher or experienced must know the most common Java questions.

They must make a list of the questions asked and keep it intact for further reference and re-revision. If you are also a Java programmer and still now don’t have the list handy then it is high time to make a list of the ten most important Java interview questions/answers.

Over 10 Frequently Asked and Common Java Interview Questions and Answers

Is Java Platform independent?

This is the most common as well as the most important question asked in any Java interview.

The answer is yes, Java is indeed a language that is platform independent. One can easily write the codes in one platform and run the application in another platform. This is in fact one of the many features of Java.

What all memory areas are allocated by JVM?

This is the second most frequently asked Java interview questions. The memory areas allocated by JVM are Class (Method) area, Heap, Stack, Program counter Register and Native Method Stack.

What is class?

This is also the most common as well the easiest question asked in any Java interview. Class is basically a template that is used to explain the data and the performance associated with the illustrations of that particular class.

Can a .java file contain more than one Java class?

This is a bit tricky question that is again very common and important. However, the answer is simple and a ‘yes.’ A .java file is capable of containing more than one Java class provided at least one of the classes is a public class.

What are the different data types in Java?

There are near about seven data types in Java. But answering only this much does not satisfies the recruiter. You must have the ability to explain each one of them. The following are the data types present in Java

  • byte-8 bit
  • short-16 bit
  • char-16bit Unicode
  • int-32bit (Whole number)
  • float-32bit (real number)
  • long-64bit (single precision)
  • double-64bit (double precision)

What is type casting in Java?

Type casting is generally to create a conversation between two types that are incompatible. Generally two types of casting are there namely, explicit casting and automatic casting. The explicit casting is done by the programmer and as the very name suggests the automatic casting is done automatically.

What are the four main principles of OOPS language?

This is also a typical Java interview question which has got an easy answer. The four main principles are- inheritance, polymorphism, data encapsulation and abstraction.

What is the function of Overriding and Overloading in Java?

The method of Overloading happens in Java when two or more methods of the similar class possess the same name but have different parameters. On the other hand the method of Overriding is totally different.

When a child class re-describes the same method of a parent class it is known as method overriding. The methods that are overridden must possess the same return type, argument list and the same name. It is not necessary that the overridden method will bound the entry of the method it supersedes.

What is static and dynamic binding?

The phenomena of linking the method call of its body are known as Binding. A binding that takes place during compile time is termed as static binding. On the other hand when a binding takes place at runtime is termed as dynamic binding.

Along with these ten most important Java interview questions/answers there are numerous basic Java questions which you may need to answer if the recruiter wants to. Therefore know these Java question answers before applying to Java jobs. Some of the basic Java interview questions that are common are-

  • What is the most important feature of Java?
  • What do you mean by platform independence
  • What is JVM?
  • What is the base class of all classes?
  • What is the difference between JDK and JVM?
  • What is a pointer?
  • Does Java support pointer?
  • Does Java support multiple inheritances?
  • Is Java a purely object oriented language?

Author Bio

Kamlesh is a blogger and a professional career author with proven expertise in writing for topics related to jobs, job trends, different job opportunities, various workplace and industry information, tips and strategies for job seekers.