Post your need

Java Interview Questions

  • What is the difference between JDK, JRE, and JVM?

    JDK stands forJava Development Kit, which is a software package that contains the tools andlibraries needed to develop Java applications. JRE stands for Java RuntimeEnvironment, which is a software package that contains the components needed torun Java applications. JVM stands for Java Virtual Machine, which is anabstract machine that executes Java bytecode.

    What are the features of Java?

    Some of the features of Java are:

    Object-oriented: Java follows the object-oriented paradigm, which means that everything in Java is an object that has attributes and behaviors.

    Platform-independent: Java is platform-independent, which means that Java applications can run on any machine that has a JRE installed, regardless of the operating system or hardware.

    Robust: Java is robust, which means that Java applications are reliable and secure. Java has features such as exception handling, garbage collection, and memory management that prevent errors and crashes.

    High-performance: Java is high-performance, which means that Java applications are fast and efficient. Java uses a JIT compiler that optimizes the code at runtime and improves the performance.

    Multithreaded: Java is multithreaded, which means that Java applications can execute multiple tasks simultaneously using threads. Threads are lightweight processes that share the same memory space and can communicate with each other.

    What is the difference between static and non-static methods in Java?

    Static methods are methods that belong to the class and can be invoked without creating an object of the class. Non-static methods are methods that belong to the object and can be invoked only by creating an object of the class. Static methods can access only static variables and static methods of the class, while non-static methods can access both static and non-static variables and methods of the class.

    What is inheritance in Java?

    Inheritance is amechanism in Java that allows a class to acquire the properties and behaviorsof another class. The class that inherits from another class is called thesubclass or child class, and the class that is inherited from is called thesuperclass or parent class. Inheritance enables code reuse and polymorphism inJava.

    What is polymorphism in Java?

    Polymorphism isa concept in Java that allows an object to take different forms depending onthe context. Polymorphism can be achieved by two ways in Java: methodoverloading and method overriding. Method overloading is when a class hasmultiple methods with the same name but different parameters. Method overridingis when a subclass redefines a method of the superclass with the same name andparameters. 

    What is an abstract class in Java?

    An abstract class is a class that is declared with the abstract keyword and cannot be instantiated. An abstract class can have abstract and non-abstract methods. An abstract method is a method that is declared without a body and must be implemented by the subclasses. An abstract class is used to provide a common template for the subclasses that inherit from it.

    What is an interface in Java?

    An interface is a collection of abstract methods and constants that are declared with the interface keyword. An interface can be implemented by any class that wants to use its methods and constants. A class can implement multiple interfaces, but can extend only one class. An interface is used to achieve abstraction and multiple inheritance in Java.

    What is the difference between ArrayList and LinkedList in Java?

    ArrayList andLinkedList are two implementations of the List interface in Java. ArrayList isbacked by an array, while LinkedList is backed by a doubly-linked list.ArrayList is faster for random access, as it can get or set an element by itsindex in constant time. LinkedList is faster for insertion and deletion, as itcan add or remove an element from the beginning or the end in constant time.

    What is the difference between equals() and == in Java?

    equals() and ==are two ways of comparing objects in Java. equals() is a method that checks iftwo objects are equal in terms of their content or state. == is an operatorthat checks if two objects are identical in terms of their reference or memorylocation. For example, two String objects with the same value may be equalaccording to equals(), but not identical according to ==.

    What is the difference between checked and unchecked exceptions in Java?

    Checked andunchecked exceptions are two types of exceptions in Java. Checked exceptionsare exceptions that are checked by the compiler at compile-time and must behandled or declared by the programmer. Unchecked exceptions are exceptions thatare not checked by the compiler at run-time and are usually caused by logicalerrors or bugs in the code. For example, IOException is a checked exception,while NullPointerException is an unchecked exception.

Interested about Java?
Get in touch with training experts Get Free Quotes
Leave a comment
Get some additional training from
our expert trainer to learn
Get a job nearby! Upload Resume
  • doc, docx, pdf are allowed
  • US (+1)
Upload your resume