Table of Contents
Java is both a platform and a programming language. It is an object-oriented, high-level, and secure programming language. Since java has its runtime environment (JRE) and API, it is called a platform.
Java is used in the development of
- Desktop applications such as media players, antivirus, etc.
- Enterprise Applications such as banking applications.
- Games, etc.
The key advantages of learning Java Programming:
- Platform Independent
This article will see all types of Interview Questions related to Java Programming language.
So, let’s get started with the Interview Questions.
Basic Level Interview Questions
- What is Java?
- Compare and contrast C++ and Java?
- List some of the features of the Java Programming language?
- What do you know about Java Virtual Machine?
- Compare JDK, JRE, and JVM?
- Name the various types of memory areas allocated by JVM?
- What is a JIT compiler?
- Explain platform?
- How will you compare the Java platform and other platforms?
- Does Java have a feature of ‘Write once and run anywhere? Explain how?
- Define classloader?
- What happens if I write static public void instead of the public static void?
- Mention the default value of the local variables in Java?
- Tell me about various access specifiers in Java?
- What is the main purpose of static methods and variables?
- List some advantages of Packages in Java?
- Explain the ‘Object-Oriented’ paradigm?
- Explain Object?
- How will you differentiate object-oriented programming language and object-based programming language?
- Define Constructor?
- Name the types of constructors used in Java?
- What is the main aim of the default constructor?
- Can we inherit the constructor?
- Explain copy constructor in java?
- Differentiate between Constructors and methods?
- What do you know about static variables?
- What is the static method?
- The main method is static? Why?
- Is there any way to override the static methods?
- What is a static block?
- Is it possible to execute a program without java’s main () method?
- Write differences between the static (class) method and instance method?
- Is it possible to make constructors static?
- Can we make abstract methods static in java?
- List some uses of the ‘this’ keyword?
- Explain Inheritance?
- What is the use of Inheritance in Java?
- Name the class which is a superclass for all the classes?
- What is the main reason that java does not support multiple inheritances?
- Differentiate between aggregation and composition?
- Does java support pointers? If not, why?
- What is super in java?
- What are the important uses of the super keyword?
- Compare this and the super keyword?
- What do you know about object cloning?
- What is method overloading?
- Explain method overloading with type promotion?
- Explain covariant return type?
- What are the final variables?
- What is the final blank variable?
- Does the Java language support method overload by changing the return type?
- Is it possible to overload the methods by making them static?
- Is overriding the overload method possible?
- Can we manipulate the scope of the overridden method in the subclass?
- Highlight some differences between the final method and abstract method?
- Which language is better, according to you – java or python?
- Explain String pool in java?
- What do you know about the interface in java?
- Explain thread lifecycle in java?
Advance level Interview Questions
- Why java is not a complete object-oriented language?
- Explain the default and parameterized constructors in java?
- For how long does heap and stack memory live in java?
- What is an instance variable in java?
- Differentiate between instance variable and local variable in java?
- What is the meaning of ‘final’ with context to method?
- Define “final class” in java?
- What is the role of JIT?
- Compare and contrast an object and a class?
- Explain the advantages and disadvantages of java sockets?
- Explain garbage collection in java? What is its use?
- Explain synchronization concerning multithreading?
- Mention the different ways of using threads?
- Explain Immutable class? How can we create immutable classes?
- Explain pass by value and pass by reference in terms of Java?
- Differentiate between Array list and vector?
- What are Hashmap and Map?
- What is an iterator?
- Write one line of code that represents an array that is not null but empty?
- Is it possible to have multiple main methods in the same class?
Core Java Interview Questions
- Is there any need to import java.lang package anytime?
- Can a user import the same package/class twice?
- Can JVM load the package twice at runtime?
- What do you understand by checked and unchecked Exception?
- Explain different types of inner classes?
- At compile time in Java, are the imports checked for validity?
- When we import a package, do the sub-packages also get imported as well?
- Explain the difference between declaring and defining a variable?
- Mention the default value of an object reference declared as an instance variable?
- A top-level class is private or protected?
- Define Serialization?
- How can we serialize an object to a file?
- Differentiate between compile time and run time polymorphism?
- Explain Encapsulation in java?
- What are literals?
- Is the code written below valid or not?
- Explain the two-dimensional array?
- Highlight differences between the add and offer methods on the Queue interface?
- How will you swap two elements in a list?
- What are the different ways to handle exceptions in java?