Java Interview Questions

Dear Readers, these JAVA INTERVIEW QUESTIONS have been prepared to introduce you to the type of questions you may face in your interview based on JAVA.


Java is both an Object Oriented programming language and a platform developed by Sun Microsystems. It is used for developing applications for the internet.

  1. What are features of java?
  • Object Oriented Programming Language
  • Programming support for internet
  • Robust programming language
  • Platform Independent
  • Interpreted
  • Secure
  • Multi-threaded
  • Portable

[widget id=”text-15″]

2. What are the important features of Java 8?

Java 8 is the newest version of java released by oracle in the year of 2014. It includes various enhancements.

Following are features of Java 8:

  • Functional Interfaces
  • Stream API
  • Lambda Expressions
  • Java IO improvements
  • Collection API improvements
  • Default and static methods in interfaces
  • JDBC Enhancements
  • ForEach() method

3. What do you meant by Platform Independence?

Platform independence is one of the features of java. It means, java source code written in one operating system can also be executed in other operating system. Example: We can write a java program in Mac OS and able to run the same program in Windows.

[widget id=”text-3″]

4. What are 4 Major Principles of Object-Oriented Programming?

  • Encapsulation
  • Abstraction
  • Inheritance
  • Polymorphism

5. What does JVM mean?

Java Virtual Machine (JVM) is the virtual machine that provides an environment to run a java program by converting java byte code into machine understandable language. It is platform dependent.

6. What is JDK?

Java Development KIT (JDK) is a software development environment which is used for developing java applications. Different JDKs are available for various platforms such as Windows, Linux etc..

[widget id=”text-15″]

7. What is JRE?

Java Runtime Environment (JRE) is a part of Java development Kit (JDK). It provides a runtime environment for the java programs to get executed and it consists of certain set of programming tools for developing java applications.

8. What is the difference between JDK and JRE?

To run applications of java and also applets, JRE needed to be downloaded and to develop and run java applications and applets JDK is required.

9. What is difference between JRE and JVM?

[widget id=”text-3″]

JRE = JVM + Class libraries + other supporting files

If we want to run any java program, JRE need to be installed in the system and JVM runs that program by utilizing the class libraries and other supported files provided in JRE.

10. Mention few Java IDEs

Intellij IDEA, Eclipse, Net beans etc….

11. List out some of the java language keywords

Here is list of some of the keywords in java programming language. You cannot use any of the keywords as identifiers.

  • Class
  • public
  • static
  • void
  • import
  • enum
  • assert
  • switch
  • throw, throws
  • new
  • strictfp  etc.

[widget id=”text-15″]

12. Define Object

  • Object is an instance of a class or
  • object is a real world or
  • object is the basic run-time entity.

13.  Define Class

Class is a group of objects with common properties. Once a class is created, any no. of instances of the class can be created for the program. It contains:

  • methods
  • fields
  • constructors

[widget id=”text-3″]

14. Which is the superclass of all the classes?

Object class is the top most class from which all other classes are derived and it is defined in java.lang.Object is the root class.

15. What are the various variable types available in java language?

  • Class/ Static variables
  • Local variables and
  • Instance variables

16. What is a local variable?

Variables that are declared inside methods, constructors or blocks are called as Local variables. That variable can be used within that method only. It will be declared within the method and will be destroyed once, it is out of the method.

17. What is a Class/Static Variables?

Class variables are also known as static variables. These are the variables that are declared within a class with static keyword but, outside of a method.

18. What is Instance variable?

This is the variable which is declared within the class and outside of the method. Instance variable is created when an object is created with a keyword ‘new’ and destroyed when that object got destroyed.

[widget id=”text-15″]

19. What is the Difference between Path and ClassPath in java?

Path is an environmental variable which specifies the bin directory path of JDK/JRE from which binaries under that directory can be accessed directly.

ClassPath is the location of .class file where classes we compiled will be available.

20. What is the significance of main method in java?

Every program starts its execution from a point. For a standalone application main() method is the starting point. Any java class can be compiled without a main() method, but not standalone application. Hence, main() method is considered to be the start point of an application.

To get more questions directly to your inbox, subscribe to our newsletter  🙂

[wd_hustle id=”coderefer-email-optin-form”]