Junior Java Developer

10+ Junior Java Developer Interview Questions and Answers for Freshers

Updated 2 Jul 2025
search-icon

Q. For a circular cake shared by 8 members, what is the minimum number of cuts required to divide the cake equally?

Ans.

To cut a circular cake for 8 members equally, only 2 straight cuts are needed.

  • Make the first cut through the center, dividing the cake into 2 equal halves.

  • Make the second cut perpendicular to the first, creating 4 equal quarters.

  • Each quarter can then be further divided into 2 equal pieces, resulting in 8 equal slices.

  • This method minimizes the number of cuts while ensuring equal distribution.

3d ago

Q. Why we need Oops concepts? What is Constructor? Need of Constructor? StringBuilder? etc.

Ans.

OOPs concepts are important for code reusability, maintainability, and scalability. Constructors are special methods used to initialize objects.

  • OOPs concepts help in creating modular, reusable, and maintainable code.

  • Inheritance, polymorphism, encapsulation, and abstraction are the four pillars of OOPs.

  • Constructors are special methods used to initialize objects with default or user-defined values.

  • StringBuilder is a class used to manipulate strings efficiently.

  • It is important t...read more

Q. What are the aggregate functions in SQL?

Ans.

Aggregate functions in SQL are used to perform calculations on a set of values and return a single value.

  • Common aggregate functions include COUNT, SUM, AVG, MIN, and MAX.

  • COUNT returns the number of rows that match a specified condition.

  • SUM calculates the sum of a column's values.

  • AVG calculates the average of a column's values.

  • MIN returns the minimum value in a column.

  • MAX returns the maximum value in a column.

  • Aggregate functions can be used with the GROUP BY clause to perform ...read more

4d ago

Q. What is responsible for executing Java programs?

Ans.

Java Virtual Machine (JVM) is responsible for executing Java programs.

  • JVM is a virtual machine that interprets compiled Java code.

  • It provides a runtime environment for Java programs to run.

  • JVM is platform-independent and provides memory management, security, and other features.

  • Java programs are compiled into bytecode, which is then executed by the JVM.

  • JVM is responsible for loading classes, verifying bytecode, and executing the program.

Are these interview questions helpful?

Q. How many columns are there in Bootstrap?

Ans.

There are 12 columns in Bootstrap grid system.

  • Bootstrap grid system is divided into 12 columns.

  • Columns can be combined to create different layouts.

  • Example:

    will create a column that spans half of the row.

5d ago

Q. Why was Servlet not removed from Java technology?

Ans.

Servlets are still relevant for web development in Java

  • Servlets provide a lightweight and efficient way to handle HTTP requests and responses

  • They can be used for dynamic web content generation and server-side processing

  • Servlets are extensible and can be integrated with other Java technologies like JSP and JDBC

  • Alternative technologies like Spring MVC and RESTful APIs build on top of Servlets

  • Removing Servlets would break backward compatibility and disrupt existing Java web appl...read more

Junior Java Developer Jobs

Capgemini Technology Services India Limited logo
Junior Java Developer 1-4 years
Capgemini Technology Services India Limited
3.7
Bangalore / Bengaluru
Numinolabs logo
Jr. Java Developer 2-4 years
Numinolabs
4.4
South Goa
Neova Solutions Pvt Ltd logo
Jr Java Developer 1-4 years
Neova Solutions Pvt Ltd
3.8
Pune

Q. Is Java an interpreted or compiled language?

Ans.

Java is a compiled language that is first compiled into bytecode and then interpreted by the Java Virtual Machine (JVM).

  • Java is first compiled into bytecode by the Java compiler.

  • The bytecode is then interpreted by the Java Virtual Machine (JVM) at runtime.

  • This combination of compilation and interpretation makes Java a compiled language with some interpreted features.

2d ago

Q. What is the working mechanism of a hashmap?

Ans.

A hashmap stores key-value pairs, using a hash function to compute an index for efficient data retrieval.

  • Uses a hash function to convert keys into hash codes.

  • Stores entries in an array, where each index corresponds to a hash code.

  • Handles collisions using techniques like chaining or open addressing.

  • Example: For key 'apple', hash function might return index 3, storing value at array[3].

  • Resizes the array when the load factor exceeds a threshold to maintain performance.

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
2d ago

Q. What is the working mechanism of Java Streams?

Ans.

Java Streams provide a functional approach to processing sequences of elements, enabling efficient data manipulation and transformation.

  • Streams are part of the java.util.stream package and allow for functional-style operations on collections.

  • They support operations like filter, map, and reduce, enabling concise and readable code.

  • Example: List<String> names = Arrays.asList('Alice', 'Bob', 'Charlie'); names.stream().filter(name -> name.startsWith('A')).forEach(System.out::print...read more

Asked in Deloitte

2d ago

Q. What is jdk,jre , thread , collection

Ans.

jdk is Java Development Kit, jre is Java Runtime Environment, thread is a unit of execution, collection is a group of objects.

  • JDK is a software development kit used to develop Java applications.

  • JRE is a runtime environment used to run Java applications.

  • Thread is a lightweight unit of execution within a process.

  • Collection is a group of objects that can be manipulated as a single unit.

Asked in TCS

2d ago

Q. What is a constructor?

Ans.

A constructor is a special method that is used to initialize objects in Java.

  • Constructors have the same name as the class they belong to.

  • They are called automatically when an object is created.

  • They can take parameters to initialize the object's state.

  • If a class does not have a constructor, a default constructor is provided.

  • Constructors can be overloaded to provide multiple ways to initialize an object.

3d ago

Q. Write a program demonstrating inheritance.

Ans.

Inheritance in Java allows a class to inherit properties and methods from another class, promoting code reusability.

  • Inheritance is a fundamental concept in OOP (Object-Oriented Programming).

  • It allows a subclass to inherit fields and methods from a superclass.

  • Example: class Animal { void eat() { } } class Dog extends Animal { void bark() { } }

  • Java supports single inheritance (one class can inherit from one superclass).

  • Use 'extends' keyword to establish inheritance.

Q. Write a Spring Boot CRUD example.

Ans.

Spring Boot CRUD example is a basic implementation of Create, Read, Update and Delete operations using Spring Boot framework.

  • Create a Spring Boot project with required dependencies

  • Define entity classes and their relationships

  • Create repository interfaces extending JpaRepository

  • Implement service classes with business logic

  • Create RESTful API endpoints using @RestController

  • Use HTTP methods to perform CRUD operations

  • Test the API using tools like Postman

3d ago

Q. How do you call REST APIs?

Ans.

To call REST APIs, use HTTP methods like GET, POST, PUT, DELETE with the API endpoint URL.

  • Use a HTTP client library like Apache HttpClient or OkHttp

  • Pass any required parameters in the request body or as query parameters

  • Handle the response returned by the API

  • Add appropriate headers like Authorization or Content-Type if required

4d ago

Q. What are the steps to establish a JDBC connection?

Ans.

JDBC Connection steps

  • Load the JDBC driver class

  • Establish a connection to the database using DriverManager.getConnection()

  • Create a statement object using the connection.createStatement() method

  • Execute the SQL query using statement.executeQuery() method

  • Process the ResultSet object returned by the query

  • Close the connection and statement objects using close() method

Q. Write an SQL update query.

Ans.

Update query to modify data in a database table

  • Use UPDATE statement followed by table name

  • Set the column(s) to be updated using SET keyword

  • Specify the new values for the column(s) to be updated

  • Add WHERE clause to specify the condition for updating specific rows

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
Infosys Logo
3.6
 • 7.9k Interviews
Wipro Logo
3.7
 • 6.1k Interviews
HCLTech Logo
3.5
 • 4.1k Interviews
IBM Logo
4.0
 • 2.5k Interviews
View all
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Junior Java Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2025 Info Edge (India) Ltd.

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits