Top 32 Java Interview Questions for 2 to 3 Years Experience

list of java

The include directive includes the original content of the page so page size increases at runtime. It is invoked at each request, same as service() method of servlet. Hibernate supports inheritance, associations, and collections. The differences between get() and load() methods are given below. Hibernate is an open source project from Red Hat Community and used worldwide.

In other words, OOP mainly focuses on the objects that are required to be manipulated instead of logic. This approach is ideal for the programs large and complex codes and needs to be actively updated or maintained. Stack memory only contains local primitive and reference variables to objects in heap space. When these both are used together, it is known as Double Brace Initialization. The inner class has a reference to the enclosing outer class, generally using the ‘this’ pointer.

Q8. What purpose do the keywords final, finally, and finalize fulfill?

Public StackTraceElement[] getStackTrace() – This method returns an array containing each element on the stack trace. The element at index 0 represents the top of the call stack whereas the last element in the array represents the method at the bottom of the call stack. Some of the important methods of Java exception class are stated below. Any change in the main thread may affect the behavior of the other threads of the process. An executing instance of a program is called a process. To create you own exception extend the Exception class or any of its subclasses.

There are lots of applications and websites that will not work unless Java is installed in them. Each day there are more and more applications created using Java. It is a very simple, powerful and robust programming language which provides a fast, secure, and reliable platform to work on. Java is being used everywhere, from laptops to data centers, game consoles to scientific supercomputers, and cell phones to the Internet. I am sure if you can answer this list of Java questions you can easily crack any core Java or advanced Java interview.

Q In java, how we can disallow serialization of variables?

A top candidate would list out some of the Java EE platforms and would give a description of one or more among them. A Senior Software Engineer is responsible for gathering systems and user requirements, building Java modules, and testing features before release. Organizations hire them to deploy and maintain functional, secure, and high-quality applications.

What is parallel processing in java 8, what are the uses of it. Difference between Hashmap vs concurrenthashmap and the follow-up question on how they work internally etc. This button displays the currently selected search type. When expanded it provides a list of search options that will switch the search inputs to match the current selection.

  • No, you cannot store a double value into a long variable without casting because the range of double is more that long and you we need to type cast.
  • In case you attended any Java interview recently, or have additional questions beyond what we covered, we encourage you to post them in our QnA Forum.
  • This section is mostly for experience Java developer, technical lead, AVP, team lead and coders who are responsible for products.

I prefer React because it allows you to create reusable components, which makes development more efficient. I also find that React is more performant than Angular. However, both frameworks are good options for developing web applications. The question evaluates the candidate’s experience using web development frameworks.

How do you merge two lists in Java?

GetServletContext() method is used to get the context object. Similarly HttpServletResponse addCookie method is provided to attach cookie in response header, there are no getter methods for cookie. SendRedirect() method works within and outside the server. SendRedirect() method sends new request always because it uses the URL bar of the browser. Java Servlet is server-side technologies to extend the capability of web servers by providing support for dynamic response and data persistence. An aggregation is a specialized form of Association where all object has their own lifecycle but there is ownership and child object can not belong to another parent object.

classes and interfaces

If you think, I have missed any popular Java question here and you think it should be in this list then feel free to suggest me. My goal is to create the best list of Java Interview Questions with the latest and greatest questions from recent interviews. Like the previous question, this is another frequently asked Java interview question from errors and exception topic but too easy to answer.

The most common type of Connection Leak experienced in Java development, is when using a Connection Pool . We can fix it by closing the connection and giving special attention to the error handling code. Continuous integration is a coding philosophy or deployment practice in which developers integrate their code in a shared repository several times a day.

Statement executeQuery is used to execute Select queries and returns the ResultSet. ResultSet returned is never null even if there are no records matching the query. Statement execute is used to execute any SQL query and it returns TRUE if the result is an ResultSet such as running Select queries. The output is FALSE when there is no ResultSet object such as running Insert or Update queries. We can use getResultSet() to get the ResultSet and getUpdateCount() method to retrieve the update count.


This is now becoming less popular and you would only find this with interviews with small companies, both investment banks and startups are moved on from this question. This is another popular question from the design pattern. Many Java developers with 4 to 6 years of experience know the definition but failed to give any concrete example. Since many of you might not have used this pattern, it’s better to look examples from JDK. You are more likely have used them before and they are easy to remember as well. Though both patterns help to take out object creation part from application logic, use of dependency injection results in cleaner code than factory pattern.

Q Can a class in Java be inherited from more than one class?

It allows users to choose between databases and enables developers to write database applications in Java without the need to worry about the underlying details of specific databases. Beans are the objects that form the backbone of an application and are managed by the Spring IoC container. Beans are created with the configuration metadata that is supplied to the container. This detailed Java Mock Test Quiz will help you to clear the doubts about Java interview questions and will also help you to crack the interview. In Java, a connection leak is a situation when the developer forgets to close the JDBC connection, it is known as connection leak.

Software Developer vs. Software Engineer: 10 Key Differences – Spiceworks News and Insights

Software Developer vs. Software Engineer: 10 Key Differences.

Posted: Mon, 12 Sep 2022 07:00:00 GMT [source]

We have compiled a set of questions with the help of 70+ hiring managers at different organizations. Software Engineer position are expertise in Software development Java, J2EE, and frameworks. Therefore, look for a candidate who has knowledge of all these.

The runtime system looks for a way to handle an exception that a method throws. The ordered list of methods that were called to get to the method where the error occurred is the collection of potential “somethings” that can be used to manage the exception. The call stack is the list of methods, and exception propagation is the search technique. Initializing the state of the object is done by constructors.

Any java interview questions for senior developer which is having single abstract can be called as Functional Interface. So, in java you don’t have to worry about the memory management like CPP, It good to know who this works in java. Especially after java 8 changes where there is major updates regarding to it.