Skip to main content

Java Technology Interview Questions


Java Basics (Core Java):
  1. Explain Inheritance, Composition and Aggregation
  2. Explain Singleton Pattern
  3. Can I create  a sub class of a static/abstract class ?
  4. Difference between sleep() and wait()
  5. Where are local variables stored in JVM ? [Stack/Heap]
  6. What are Transient and Volatile Variables ? when do you use them ? 
    Transient:
    Dictionary Meaning of Transient : One who stays for only a short time.
    You use the transient keyword to indicate to the Java virtual machine that the indicated variable is not part of the persistent state of the object. Variables that are part of the persistent state of an object must be saved when the object is archived.
     Volatile:
    If your class contains a member variable that is modified asynchronously by concurrently running threads, you can use Java's volatile keyword to notify the Java runtime system of this.
  7. What are deadlocks and how are they caused ?
  8. What is Serialization and Externalization ?
    When do you use Serialization and when do you use Externalizable interface ? Give examples

    Serialization: Converting an object into bytecode and then retrieve the object from bytecode is called serialization. Serialization process is acheived by implementing Serialization Interface. This is a marker interface which does not have any fields or methods.

    Externalization: Externalization is specialized form of serialization where you have total control on what to be written in the bytecode and what need to be extracted from bytecode into Object. Externalizable interface extends Serialization Interface.

  9. Difference between ArrayList and LinkedList ?
    ArrayList and LinkedList both implements List interface and maintains insertion order. Both are non synchronized classes.
    ArrayList internally uses a dynamic array to store the elements.LinkedList internally uses a doubly linked list to store the elements.
    Manipulation with ArrayList is slow in Arraylist and faster in Linkedlist.
    ArrayList is better for storing and accessing data.

  10. What is a Binary Search Tree ?



Servlets
  1. What is the difference between Servlet and JSP ?
  2. What is the difference between ServletConfig and ServletContext objects ?
    ServletContext and ServletConfig are both java interfaces used to set paratemers at various levels in the application.
    ServletContext has application scope and it can pass the parameters to any of the requested servlets. These paramters are defined in web.xml with elements
    ServletConfig has servlet scope and it can only pass the paramters that are defined for that particular servlet. These parameters are defined in web.xml under each element.
    A servlet container can have Multiple ServletConfig objects but only one ServletContext object. Each ServletConfig  has a ServletContext object.

JSP:
  1. Implicit variables in JSP [request, response, session, page, application, out, config, context]
  2. Scripting Elements : 
    • Expressions of the form <%= expression %> that are evaluated and inserted into the output
    • Scriptlets of the form <% code %> that are inserted into the servlet's service method
    • Declarations of the form <%! code %> that are inserted into the body of the servlet class
  3. Action
  4. Directives <@include, <@taglib
  5. what is the difference between  and <@include
  6. Can we create a datasource in JSP ?


Frontend(Javascript, Ajax, JQuery)

Struts:
  1. Explain architecture of struts
  2. Validation in Struts
  3. Difference between ForwardAction and DispatchAction


Java Web Applications:
  1. Typical Structure of Web Application Directory
  2. How do you resolve Out of Memory Exceptions
  3. When do you use Clustering and Loadbalancing ?
  4. If a shopping cart application requires very high availability then do you implement clustering or loadbalancing ?


Java Portals:
What is JSR 168/286 [Java Portlet Specification]

Java Web services

  1. Is it possible to generate WSDL from java static method?
  2. How are REST web services different from SOAP based Web services ?



Java Security
  1. Explain different security threats to Java/software applications?
  2. Have you used any security algorithms like SHA 256 or SHA 512 ?


JMS

  1. State a scenario when you go for Queue and Topic ?


JSF

Spring
  1. What is Dependency Injection? Different types of injection?  [Setter Injection, Constructor Injection]
  2. What is AOP?  Given an Example?  [Cross cutting concerns like Logging, Exception Handling, Security]


Hibernate
  1. What is ORM
  2. Explain the advantages of using Hibernate in applications?
  3. How do you insert the data in hibernate?


Database:
  1. What are different types of Joins?
  2. Difference between Inner Join and Outer Join with an example
  3. Write a small stored procedure to retrieve Name and ID from EMP table?
  4. What is SQL Injection?
  5. What is the difference between Stored Procedure and Function?
SpringBoot:

What is the purpose of using @ComponentScan in the class files?

Spring Boot application scans all the beans and package declarations when the application initializes. You need to add the @ComponentScan annotation for your class file to scan your components added to your project.

What is the difference between @RestController and @Controller in Spring Boot?

@Controller Map of the model object to view or template and make it human readable but @RestController simply returns the object and object data is directly written in HTTP response as JSON or XML

What is Spring Actuator? What are its advantages?

An actuator is an additional feature of Spring that helps you to monitor and manage your application when you push it to production. These actuators include auditing, health, CPU usage, HTTP hits, and metric gathering, and many more that are automatically applied to your application.

How to enable Actuator in Spring boot application?

To enable the spring actuator feature, we need to add the dependency of “spring-boot-starter-actuator” in pom.xml.

<dependency>
<groupId> org.springframework.boot</groupId>
<artifactId> spring-boot-starter-actuator </artifactId>
</dependency>

What are the actuator-provided endpoints used for monitoring the Spring boot application?

Actuators provide below pre-defined endpoints to monitor our application -

  • Health
  • Info
  • Beans
  • Mappings
  • Configprops
  • Httptrace
  • Heapdump
  • Threaddump
  • Shutdown






Comments

Popular posts from this blog

Outsystems Integrations - Connecting to Microsoft Azure Sql Server

In this article, I will show you how to set up your own Microsoft Azure SQL Server Database and then how to integrate this SQL Server database in Outsystems. Create a free Microsoft Azure Account. https://portal.azure.com. Microsoft Azure is a cloud computing service for building, deploying and testing application through Microsoft managed data centers (similar to Amazon’s AWS services) Microsoft provides free accounts with free credit of $200 to spend in the first year of new account. I am using this feature to create a Microsoft Azure SQL Server database in the cloud and will show how easy it is to connect this Azure AQL Server from Outsystems. Click on Add button to add a Azure SQL Database Fill in the details and click on Create button. Your deployment will take few seconds to few min to create. Look for the status in the table. It will change to Created automatically without refreshing the screen and finally when your screen says deployment is compl...

Outsystems Tips and Tricks : Adding iFrame in Reactive Web App

In Outsystems Version 11+, there is no iFrame widget available when you are building Reactive Web Applications. So in case you want to add an iFrame HTML tag or for that matter any other HTML element, you could do so by creating a generic web block and pass HTML in to it by doing as follows.