0% found this document useful (0 votes)
3 views16 pages

Java Questions

The document provides a comprehensive Java Developer interview preparation guide for candidates with 1-2 years of experience. It includes common interview questions and answers covering topics such as Core Java, OOP concepts, memory management, SQL, Hibernate, Spring, and project-related inquiries. Additionally, it offers advice on how to present oneself and prioritize skills on a CV for a Java Developer role.

Uploaded by

pradeep
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views16 pages

Java Questions

The document provides a comprehensive Java Developer interview preparation guide for candidates with 1-2 years of experience. It includes common interview questions and answers covering topics such as Core Java, OOP concepts, memory management, SQL, Hibernate, Spring, and project-related inquiries. Additionally, it offers advice on how to present oneself and prioritize skills on a CV for a Java Developer role.

Uploaded by

pradeep
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

I reviewed your CV. Your profile is for a **Java Developer with 1.

5 years of
experience** at Innovative Tech Pvt. Limited, with skills in **Core Java,
OOP, SQL, JSP/Servlets, Hibernate, JPA, Spring, Tomcat, Git, Maven, and
basic frontend technologies**.

Based on your CV, this is a realistic **Java Developer interview


preparation set**.

# Java Developer Interview Preparation (1–2 Years Experience)

## 1. Tell me about yourself.

**Answer:**

> I am Pradeep Lal Das Sharma, a Java Developer with around 1.5 years
of experience at Innovative Tech Pvt. Limited. I have worked on
developing and maintaining Java-based web applications using Core Java,
OOP concepts, JSP, Servlets, Hibernate, JPA, and SQL databases.

>

> In my current role, I work on backend modules, database operations,


debugging, and application deployment using Apache Tomcat. I have
experience working with IDEs like Eclipse and IntelliJ IDEA and tools like
Git and Maven.

>

> I have also worked on proof-of-concept projects to validate ideas before


implementation. I am interested in improving my skills in enterprise Java
development and contributing to scalable applications.

# Core Java Questions

## 2. What are the main features of Java?


**Answer:**

Java features:

* Platform independent (“Write Once, Run Anywhere”)

* Object-oriented

* Secure

* Robust

* Multithreaded

* High performance through JVM optimization

* Automatic garbage collection

## 3. Explain OOP concepts.

**Answer:**

The four pillars of OOP are:

### Encapsulation

Wrapping data and methods into a single unit (class).

Example:

```java

Class Student {

Private String name;


Public String getName(){

Return name;

```

### Inheritance

One class acquiring properties of another class.

```java

Class Animal {}

Class Dog extends Animal {}

```

### Polymorphism

One method behaving differently in different situations.

Types:

* Compile-time polymorphism (method overloading)

* Runtime polymorphism (method overriding)

### Abstraction

Hiding implementation details and showing only required features.


Using:

* Abstract classes

* Interfaces

# Java Memory / JVM Questions

## 4. Explain JVM, JRE, and JDK.

**Answer:**

**JDK**

* Development kit

* Contains compiler and tools

* Used for developing Java applications

**JRE**

* Runtime environment

* Runs Java applications

**JVM**

* Executes Java bytecode

* Provides platform independence

Hierarchy:
```

JDK

JRE

JVM

```

## 5. Difference between Stack and Heap memory.

| Stack | Heap |

| ---------------------- | ------------------------- |

| Stores local variables | Stores objects |

| Faster | Slower |

| Thread-specific | Shared memory |

| Automatically removed | Garbage collector manages |

# String Questions

## 6. Difference between String, StringBuilder, and StringBuffer.

**Answer:**

### String

* Immutable
* Any modification creates a new object

### StringBuilder

* Mutable

* Faster

* Not thread-safe

### StringBuffer

* Mutable

* Thread-safe

* Slower than StringBuilder

# Collection Framework Questions

## 7. Difference between ArrayList and LinkedList.

| ArrayList | LinkedList |

| ------------------ | ------------------------- |

| Uses dynamic array | Uses doubly linked list |

| Faster searching | Faster insertion/deletion |

| Less memory | More memory |

## 8. Difference between HashMap and Hashtable.

| HashMap | Hashtable |
| --------------------- | ------------------- |

| Not synchronized | Synchronized |

| Allows null key/value | Does not allow null |

| Faster | Slower |

# Exception Handling

## 9. Explain checked and unchecked exceptions.

**Checked Exception**

* Checked during compile time

* Example:

```

IOException

SQLException

```

**Unchecked Exception**

* Occurs during runtime

* Example:

```

NullPointerException

ArithmeticException

```
# Database / SQL Questions

## 10. Explain your SQL experience.

**Answer:**

 I have worked with relational databases like MySQL and Oracle. I


have written SQL queries involving joins, filtering, aggregation,
stored procedures, and database schema modifications. I have also
optimized queries to improve application performance.

## 11. Difference between INNER JOIN and LEFT JOIN.

### INNER JOIN

Returns matching records from both tables.

Example:

```

Employee

INNER JOIN

Department

```

Only employees having departments are returned.


### LEFT JOIN

Returns all records from the left table and matching records from right
table.

# Hibernate / JPA Questions

## 12. What is Hibernate?

**Answer:**

Hibernate is an ORM framework that maps Java objects to database


tables.

Benefits:

* Reduces JDBC code

* Automatic SQL generation

* Database independence

* Supports caching

## 13. Difference between Hibernate and JDBC.

| JDBC | Hibernate |

| ------------------ | ------------------------ |

| Manual SQL writing | Automatic SQL generation |

| More code | Less code |


| Database dependent | Database independent |

| No ORM | ORM based |

# Spring Questions

## 14. What is Spring Framework?

**Answer:**

Spring is a Java framework used for building enterprise applications.

Features:

* Dependency Injection

* MVC architecture

* Transaction management

* Integration with Hibernate/JPA

## 15. Explain Dependency Injection.

**Answer:**

Dependency Injection means providing object dependencies from outside


instead of creating them inside the class.

Example:
Without DI:

```java

Class Car{

Engine e = new Engine();

```

With DI:

```java

Class Car{

Engine e;

Car(Engine e){

This.e=e;

```

Benefits:

* Loose coupling

* Easier testing

# Servlet/JSP Questions

## 16. Difference between Servlet and JSP.


| Servlet | JSP |

| ----------------------- | ---------------------- |

| Java class | HTML with Java support |

| Used for business logic | Used for presentation |

| More code | Easier UI development |

# Tomcat Questions

## 17. What is Apache Tomcat?

**Answer:**

Tomcat is a web server and servlet container used to run Java web
applications.

It supports:

* Servlets

* JSP

* Java web applications

# Project-Based Questions (Very Important)

## 18. Explain your project.

Use this structure:


**Project Name: Internal Business Application**

Answer:

> In my current company, I worked on Java-based internal business


applications. My responsibilities included developing backend modules,
creating database operations, debugging issues, and supporting
JSP/Servlet-based web modules.

>

> I worked with Hibernate and JPA for persistence, SQL queries for data
handling, and deployed applications on Apache Tomcat. I also participated
in code reviews, sprint planning, and testing activities.

## 19. Explain a challenging problem you solved.

Answer:

 One challenge I faced was optimizing slow database operations. I


analyzed SQL queries, improved joins and indexing, and reduced
unnecessary database calls. This improved application response
time.

# Coding Questions You Should Practice

### 1. Reverse a String

Input:
```

Java

```

Output:

```

avaJ

```

### 2. Find duplicate elements in an array.

### 3. Count frequency of characters in String.

### 4. Difference between == and equals().

### 5. Implement Singleton class.

# HR Questions

## Why should we hire you?

Answer:
 I have practical experience developing Java applications and
working with enterprise technologies like Spring, Hibernate, JSP, and
SQL. I can quickly understand existing systems, debug problems,
and contribute effectively while continuously improving my skills.

## Where do you see yourself after 5 years?

Answer:

 I want to become a strong backend engineer with expertise in Java


enterprise development, Spring Boot, cloud technologies, and
system design while contributing to large-scale applications.

## Final Preparation Priority for Your CV

Based on your experience, focus most on:

1. **Core Java + OOP**

2. **Collections Framework**

3. **Exception Handling**

4. **SQL Queries + Joins**

5. **Hibernate/JPA**

6. **Spring Framework**

7. **Servlet/JSP lifecycle**

8. **Your project explanation**

Your CV is aligned more with a **Java Developer (1–2 years experience)


role**, so interviewers will likely focus more on practical understanding
than advanced system design.

You might also like