In This Blog; We are listed top 50+ most asked Java Interview Questions for freshers and experienced bath candidates & all questions listed with Answers.

Java is one of the most popular, secure, and high-level programming languages [THE REASON IS] Java is a platform independent programming language.

Java interview questions list are mentaioned below with answers and example:

Java Interview Questions
Java Interview Questions & Answers

Q1- What is Java?

Java is a platform independent and high-level, most secure, and object-oriented programming language. It was developed by Sun Microsystems.

Q2- What is the diffrence between JDK, JRE and JVM?

JDK - JDK stands for Java Development Kit.
JRE - JRE stands for Java Runtime Environment.
JVM - JVM stands for Java Virtual Machine that enables the computer to run the Java program.

Q3- Why Java is platform independent?

Java is platform independent because of its byte codes which can run on any system irrespective of its underlying operating system.

Q4- What are the principle of Oops concepts in Java?

There are four principle used in Java Oops concepts:

  • Inheritance
  • Encapsulation
  • Polymorphism
  • Abstraction

Q5- What is JIT compiler?

JIT stands for Just-In-Time compiler. Just-In-Time compiles parts of the bytecode that have similar functionality at the same time, and hence reduces the amount of time needed for compilation.

Q6- What is this keyword in java?

This Keyword is a reference to the current object, use to refer current class instance variable. And used to invoke current class method.

Q7- What are the features in Java?

There are following features listed in Java programming language:

  • Oops concepts
  • Platform Independent
  • High Performance JIT Compiler
  • Multi-threaded

Q8- What are constructors in Java?

The constructor refers to a block of code which is used to initialize an object and there are two constructors use in Java mentained below:

  • Default Constructor - Default constructors are the no argument constructors
  • Parameterized Constructor - Initializing the instance variables with the provided values

Q9- What are the various access specifiers in Java?

  • Public
  • Protected
  • Default
  • Private

Q10- What is an object?

The Object is the real-time entity, it having behavior and state. And In Java, The object of a class created by using the new keyword.

Q11- Does constructor return any value?

The constructor implicitly returns the current instance of the class.

Q12- Why Java is considered dynamic?

Java considered dynamic because it is designed to adapt to an evolving environment.

A Java programs can carry extensive amount of run-time information that can be used to verify and resolve accesses to objects on run-time.

Q13- Is constructor inherited?

The constructor is not inherited.

Q14- What is Encapsulation?

Encapsulation is a principle of Oops concepts and a technique used for hiding the properties and behaviors of an object. Encapsulation allow outside access only as appropriate.

Q15- What is the number of bits used to represent ASCII, Unicode, the UTF-16, and the UTF-8 characters?

  • ASCII: Used 7 bits as well as 8 bits digit patterns.
  • Unicode: Used 16 bits digit patterns.
  • UTF-8: Used 8, 16, and 18 bits digit patterns.
  • UTF-16: Used 16 bits OR larger digital patterns.

Q16- What is a Class?

Basically, All Java codes are written within a class. And a class is the collection of variables and methods.

Q17- What is Inheritance?

Actually, Inheritance means that one class can extend to another class. Inheritance is applicable for public and protected members only.

Q18- What is the difference between path and classpath variable?

Path - It is used to find out binary files location by command prompt
Classpath - It is used by compiler and JVM to find out location of library files

Q19- What is implicit casting?

Implicit casting is a process of converting lower range datatype variable to higher range datatype variable.

Q20- What is Classloader?

Classloader is a subsystem of JVM which is used to load class files.

There are three Classloaders built in Java.

  • Bootstrop Classloader - Bootstrop Classloader is the first classloader which is the superclass of Extension classloader.
  • Extension Classloader - Extension Classloader is the child classloader of Bootstrap and parent classloader of System classloader.
  • System/Application Classloader - System/Application Classloader is the child classloader of Extension classloader.

Q21- What is explicit casting?

Explicit casting is a process of converting higher range datatype variable to lower range datatype variable with the help of cast operator.

Q22- What is an exception in Java?

Exceptions are unexpected events that occur at run time Java codes, basically the exception is one that is “checked” at compile time. The exception is indicate a serious problem in the code.

Q23- What are the Java IDE's?

NetBeans and Eclipse are the IDE's of Java

Q24- What is the difference between System.out, System.err, and

  • System.out: System.out function used to display normal messages and results.
  • System.err: System.err function used to represent error messages.
  • function used to display InputStream object which by default represents standard input device.

Q25- Difference between final, finally and finalize() in Java

final - Final keyword is a variable in Java. It acts as a constant, a final class is immutable, and a final method cannot be overriden in a child class.

finally - The finally keyword is used with try-catch block for handling exceptions.

  • The finally code block is always executed after try or catch block is completed.
  • The finally block is optional in try-catch block.

finalize() - finalize() function is the function of Object class. It is used to invoked before an object is discarded by the garbage collector.This method is called finalize().

Q26- What is Multi-threading in Java?

Multiple threads are executed simultaneously in Java & each thread starts their own stack based on the flow of the threads.

Q27- What is polymorphism in Java?

The Java polymorphism have ability to define a funtion in multiple forms. There are two types of polymorphism used in Java:

  • Compile Time Polymorphism (Method Overloading)
  • Run Time Polymorphism (Method Overriding)

Method Overloading

When several methods have same names but different number or type of parameters is called Method Overloading.

Method Overriding

A child class implements the method with the same signature as a method in a parent class is called Method Overriding.

Q28- What are the features of Interface?

An interface is a collection of abstract methods. There are some features of Interface in Java listed below:

  • An Interface cannot be instantiated.
  • Interface does not contain any constructors.
  • All of the methods in an interface are abstract.

Q29- Can we override the private methods?

The scope of private methods is limited to the class and we cannot access them outside of the class. So; We cannot override the private methods into other methods.


GDATAMART.COM is optimized for learning & job information; The users try to improve your knowledge and practical experience through this site but we cannot warrant full correctness of all content... Learn More →

© 2020 GDATAMART | All Rights Reserved