Are you aspiring for a long career as a java developer? If yes, then for a fresher, interviews can be quiet intimidating. Many talented candidates find it difficult to crack their interviews. Personal technical interviews are meant to test your technical skills. Performing well in these interviews can improve your chances of being hired.
Here are the top 20 interview questions to help you prepare better for your next Java interview
1. What is JVM?
JVM stands for Java Virtual Machine. It provides a runtime environment to drive the Java Code or applications by converting Java byte code into machine language. JVM is a part of the Java Run Environment (JRE).
2. Why is Java called platform independent language?
In Java, we can write and compile the code in one platform such as Windows, and subsequently, we can execute the class in any other supported platform like Linux, Solaris, or more.
3. Difference between a JDK and a JVM?
JDK is the Java Development Kit, which is for development purposes, which includes the execution environment. JVM is purely a run time environment that will be required by your source files for its compilation.
4. State the base class of all classes?
5. Define access modifiers?
In Java, Access modifiers control the access levels. There are three types of access modifiers.
There is default one too, which is specified when there is no identifier specified.
6. Define Packages?
A package is a group consisting of related classes in Java. It helps in avoiding name conflicts and creating maintainable code.
7.What is Inheritance?
Inheritance is a process of inheriting all the features of a parent class to its child class. It is one of the main parts of object-oriented programming, which enables the reusability of code and accessibility of variables and methods.
8.What is the abstract class in Java?
An abstract class is a restricted class that cannot be used to create objects achieving data abstraction.
9.What is the difference between the superclass and the subclass?
A superclass is a class that is inherited, whereas the subclass is a class that does the inheriting.
10.Define the states associated with the thread?
The states associated with a thread are:
11.Define synchronization in Java?
Synchronization helps in preventing thread interference and memory consistency errors by ensuring that only one thread is accessing the resources at a time.
12.What is deadlock?
A program is said to be in a deadlock when two threads are in a situation where they are waiting for each other and cannot proceed.
13.What is an applet?
The applet is a dynamic and interactive program that is capable of running inside a web page.
14.Explain an Applet lifecycle
15. What is the layout manager in Java AWT and state their types?
A layout manager helps in the automatic positioning of all components in Java AWT.
The different layouts are available are:
Java Database Connectivity or JDBC is an Application Programming Interface(API) used for executing SQL queries.
17. What are drivers available?
18.Define the stored procedure?
A collection of SQL statements that forms a logical unit and performs a particular task is called a stored procedure. It is used to encapsulate a set of operations or queries to execute on the database.
19. What are the two primary components of JDBC?
20. What kind of a thread is the garbage collector?
It is a daemon thread.
Apart from having your basics right, it would be best if you also had practical exposure to Java and its related technologies. Join LearnAtRISE`s exclusive Java training program and get a wide range of exposure in Java SE, Spring, Tomcat, JSP, Servlets, MySQL, JDBC, Hibernate, and more.