Pankaj
If you are preparing for a Java-based interview, it’s a good idea to go through Java Interview Questions. I have written a lot of interview questions articles in Core Java, Java EE to popular frameworks.
Let’s go through some common questions before you read articles that focus on specific areas.
There are tons of websites where you will find java interview questions. So how do you know which ones you should read? The answer is simple - read the ones that cover the latest features. Also, read the articles where you can post comments. Most of the times, the author makes some mistakes or confusing statements. Then corrects them through user feedback coming through comments.
Some of the popular topics for Java interview are:
We use Java programming everywhere. We use Java to create standalone programs, web applications, and web services. We can create distributed enterprise applications using Java EE frameworks.
Java SE is also called Core Java. It is the set of libraries that are part of standard java installation. For example, the Collections framework is part of Core Java. But, Servlet/JSP is part of Java Enterprise Edition.
Some of the advanced java concepts are:
Java is still one of the most popular programming languages. It’s still the first choice for enterprise applications. There are tons of free open source resources available to help you in Java programming. So I am not worried that Java is Dying at all.
Some of the key differences between JavaScript and Java are:
It’s like comparing Apples to Oranges. Both Java and Python are very popular programming languages. It depends on the project whether you want to use Java or Python or sometimes both together. Here are some inputs based on my personal experience working with both Java and Python for a long time.
Java was first created by James Gosling at Sun Microsystems. The first public version was released in 1996.
Java 12 is the latest version, released on March 19, 2019. Now, Oracle releases a new java version every 6 months. So you can expect Java 13 release in September 2019.
Core Java is the starting point of any Java interview. A strong grip on Core Java is a must to clear the Java interview for experienced as well as beginners. This article lists the most important core java interview questions with answers.
Java 8 was a major release with many new features. Some of them are Lambdas, Functional interfaces, Streams, and Date Time API. This article will help you in preparing for the interview related to these APIs. I recently wrote another article as part-2 of java 8 interview questions.
Collections are core components of Java programming language. They are widely used in interview questions. The post contains 40+ questions on java collections to make sure all the topics are covered. I also recommend you to read java collections tutorial.
The String is the most used Java class. Java interview usually starts with tricky questions related to String. This post contains 21 questions with detailed answers for String in Java.
Multithreading and Concurrency is a hot topic in Java interviews. It’s good to have good knowledge of Threads in Java. This post covers 30+ interview questions for Java Threads. I also recommend you to read Java Thread Tutorial to gain good knowledge on Threads.
Exception Handling is one of the tricky areas. Java provides a robust and object-oriented approach for exception handling. There are Exception, Error, and Throwable at the root of Exception Handling. I have seen so many guys who are confused in checked, unchecked, and runtime exceptions. Here you will go through a list of 15 questions related to Exception Handling in Java.
You should know about the Java virtual machine, runtime environment, and Java compiler. A post dedicated to explain these and list out their differences.
Java ClassLoader comes under advanced java concepts. This article provides a detailed explanation of different types of Java classloaders. You will learn how and when we should write our own classloaders with example programs.
Abstract classes and interfaces are used in java for defining the contract. But, what is the difference between them? When should we use interface over the abstract class and vice versa? It’s a great design question and asked a lot in java interviews. This post provides all the differences between abstract class and interface. When should we use interface over the abstract class and vice versa? The post also explains how to use abstract class and interface to create a flexible design. I also recommend to read java abstract class and interface in java tutorials.
One of the most asked questions is why java doesn’t support multiple inheritances? Why should we prefer composition over inheritance? This article provides a detailed explanation of multiple inheritances. The issues with the inheritance that make composition a better approach.
Some tricky questions to test your programming skills. Also, check out java tricky code snippets.
Java 7 has improved catch block to catch multiple exceptions in a single block. It’s a good improvement for making our catch block code small when we needed to catch a lot of exceptions.
JVM runtime memory is divided into heap memory and stack memory. An important article explaining the difference between Heap and Stack memory through the program. https://www.youtube.com/watch?v=\_y7k\_0edvuY
This is one of the most confusing questions about the Java programming language. Some say it’s pass by value and somewhere you will read that it’s pass by reference. Then again behavior changes for primitive types or Object parameters? Read this out to clear this confusion once and for all. This is one of the favorite questions asked by java interviewers.
If you are working on Enterprise applications, I am sure that JDBC API is a part of it. JDBC API provides database connectivity for relational databases, such as MySQL and Oracle. This article has a collection of 40+ interview questions related to the JDBC API. They cover areas from basic Connection to DataSource to Connection Pooling. It will help you in interviews for questions related to JDBC API and how to use it. If you are new to JDBC, I would suggest you go through JDBC Tutorial to make sure you have covered all the core parts of it.
Servlets are one of the hot topics of Java Enterprise Edition interview questions. This post contains a list of 50 servlet interview questions with answers in detail. A must-have bookmarked post because I will keep on adding more questions in the future.
JSP is an integral part of Java EE. If you are giving an interview for a web developer, then having good knowledge of JSP is very important. This post contains a list of 35 JSP interview questions with answers. Please make sure to bookmark it because I will be kept on adding more to the list in the future.
Struts2 is one of the modern Java Web Application framework. This article contains a list of 30 questions with answers for Struts2 framework.
Spring Framework is the most widely used Java EE framework. It’s built on core principles of “Dependency Injection” and “Aspect-Oriented Programming”. This post contains more than 45 questions related to Spring Framework. They also cover Dependency Injection, Spring AOP, Spring JDBC, and Spring MVC.
Web services are popular these days because they are language and platform independent. It’s easy to create SOAP and REST based web services. This post will help you learn about web services and related interview questions. Then there are questions with detailed answers for Java Web Services.
More than 50 questions on JSF-2 with detailed answers, go through them as a refresher on JSF framework.
Hibernate is the best Java-based ORM tool in the market. It’s used a lot in most of the enterprise applications to overcome the shortcomings of JDBC. Hibernate provides flexible configuration using XML, JPA annotations as well as through code. So it’s always a plus point to have Hibernate in your resume.
Scala is famous programming language that provides functional programming in Java. I have written three successive posts that you can go though for scala interview.
For clearing an interview, only technical knowledge is not enough. You will have to go through common job interview questions. For example, your last company experience. Why you are looking for a change?. This article covers 40 common job interview questions.
Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.
While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.
For(;;) These is infinite loop All thing are optional but we put 1 or 0 or any negative value at condition like for (;1;) Then what will be output for any condition. It will be true or false.
- Ajinkya
looks like link is broken / page not found for Restful Interview Questions link
- Ketan
Very useful in cracking the interview. Thanks for sharing.
- Nitin
very much appreciate you time spent on publishing this blog.!
- milindu
Thank you for taking time in it and providing us.
- jijo
that makes life easy :) thanks for consolidating it.
- rohit
very much thankful for impo.question of interviews plz provide all on my mail id as well,thanks in advance aswell.
- ranjeet yadav
Thank you very much Pankaj for sharing such good collection of questions on wide variety of topics of java ,Your Book on Design patterns was really awesome.
- chandiprasad
Please help me to get a java code to get number pin which is obtained by concatenating lengths of each word of the string . for example: number pin for “wipro Technologies” is 512 wipro=“5” technologies=“12”
- Ritu Rh
Can you please shade some light on the use/need of copy constructor.
- Jt