Filter interviews by
I applied via Referral and was interviewed before Jun 2023. There were 3 interview rounds.
Constructor is a special method used to initialize an object, while a method is a function associated with an object to perform a specific task.
Constructor is called automatically when an object is created, while a method is called explicitly by the programmer.
Constructors have the same name as the class, while methods have unique names.
Constructors do not have a return type, while methods can have a return type.
Exampl...
final is a keyword used to declare constants, finalize is a method used for cleanup operations, and finally is a block used for exception handling.
final is used to declare constants in Java
finalize is a method in Java used for cleanup operations before an object is garbage collected
finally is a block used in exception handling to ensure a piece of code is always executed
Different types of injections in Spring Boot include constructor injection, setter injection, and field injection.
Constructor injection: Dependencies are provided through a class constructor.
Setter injection: Dependencies are set through setter methods.
Field injection: Dependencies are injected directly into class fields.
Spring is a framework for building Java applications, while Spring Boot is an extension that simplifies the setup and development process.
Spring is a comprehensive framework that provides support for various Java technologies like JDBC, JPA, and REST.
Spring Boot is an opinionated extension of Spring that aims to simplify the setup and development of Spring applications by providing defaults for configuration.
Spring Boo...
Use Spring Data JPA to connect a database to a Spring Boot application.
Add the necessary dependencies in the pom.xml file for Spring Data JPA and the database driver.
Configure the database connection properties in the application.properties file.
Create a repository interface that extends JpaRepository to interact with the database.
Use annotations such as @Entity, @Table, @Id, @Column, etc., to map Java objects to datab...
Access keywords control the visibility and accessibility of methods in a class.
public: accessible from any class
private: only accessible within the same class
protected: accessible within the same class and its subclasses
default (no keyword): accessible within the same package
Static methods belong to the class itself, while non-static methods belong to instances of the class.
Static methods can be called without creating an instance of the class.
Non-static methods require an instance of the class to be created before they can be called.
Static methods cannot access instance variables, while non-static methods can.
Example: Math.sqrt() is a static method, while String.length() is a non-static m
Java does not support multiple inheritance to avoid the diamond problem and maintain simplicity and clarity in the language.
Java supports single inheritance to prevent the diamond problem, where conflicts arise when a class inherits from two classes that have a common ancestor.
Multiple inheritance can lead to ambiguity and complexity in the code, making it harder to understand and maintain.
Java allows multiple interfac...
Code to add employee table in db using Spring Boot app and retrieve data of employee with second highest salary
Create Employee entity class with fields like id, name, salary
Create EmployeeRepository interface extending JpaRepository
Implement service class with methods to add employee to db and retrieve employee with second highest salary
Use @Query annotation in repository to write custom query to retrie
Join Dept table with emp table on dept id to get department of employees
Use SQL JOIN to connect Dept and emp tables on dept id
Select the Dept column from Dept table to get the department of employees
Top trending discussions
Asking the dp and tree and other
I applied via campus placement at Anna University and was interviewed in Apr 2024. There were 3 interview rounds.
General topics were given
Curd operation with SQL connectivity
I applied via Job Fair and was interviewed in Jun 2023. There were 3 interview rounds.
Ms office,Core Java , Tally , C,
In my Opinion,view , If you ask me, As far as I can see/I am Concerned , It seems to me that , I think /feel/reckon/ belive , If you want my option , What we have to decide
I applied via campus placement at CDAC, Noida and was interviewed in Jan 2022. There were 4 interview rounds.
Best way to prefer java, core java and most imp spring boot because many of companies required spring boot now a days
Path variable is used to locate executable files while classpath variable is used to locate Java classes.
Path variable is used by the operating system to locate executable files.
Classpath variable is used by Java to locate classes and resources.
Path variable is system-specific while classpath variable is Java-specific.
Path variable is set by the user while classpath variable is set by the developer.
Example of path vari...
Enum is a special data type in Java used to define a set of constants.
Enums are used to represent a fixed number of values that do not change.
They are declared using the enum keyword.
Each enum constant is an object of the enum type.
Enums can have constructors, methods, and fields.
Example: enum Color { RED, GREEN, BLUE }
Enums can also have values associated with them, like Color.RED(255, 0, 0).
2 phase commit is a protocol used to ensure distributed transactions are either committed or rolled back.
Used in distributed systems where multiple databases are involved in a transaction
Ensures all databases either commit or rollback the transaction
Involves a coordinator and multiple participants
Coordinator sends a prepare message to participants, who respond with either commit or abort
If all participants respond with...
Yes, Java is completely object oriented.
Java is designed to be completely object oriented.
All code in Java is written inside classes and objects.
Java supports encapsulation, inheritance, and polymorphism.
Java does have some non-object oriented features like primitive data types.
However, even these can be treated as objects using wrapper classes.
Exception is an event that occurs during the execution of a program and disrupts the normal flow of instructions.
Exceptions are objects that are thrown at runtime when an abnormal condition occurs
Java provides a set of predefined exceptions that can be used to handle errors
Exceptions can be caught and handled using try-catch blocks
Unchecked exceptions are those that are not checked at compile-time, while checked except
I applied via Job Portal and was interviewed in Mar 2022. There were 2 interview rounds.
2 rounds easy
I applied via Campus Placement and was interviewed in Aug 2021. There were 5 interview rounds.
Switch case is used for multiple conditions while if else is for binary conditions. Sorting can be done using various algorithms.
Switch case is faster than if else for multiple conditions
If else is more readable for binary conditions
Sorting can be done using bubble sort, insertion sort, quick sort, etc.
Example code for bubble sort: for(i=0;i
Difference between compiler and interpreter with a coding challenge
Compiler translates the entire code into machine language before execution while interpreter translates line by line during execution
Compiler generates an executable file while interpreter does not
Compiler is faster but debugging is harder while interpreter is slower but debugging is easier
Coding challenge: Write a program to find the sum of two numbers
I applied via Naukri.com and was interviewed in Dec 2020. There were 3 interview rounds.
An object is an instance of a class that encapsulates data and behavior.
Objects have attributes (data) and methods (behavior).
Objects can interact with each other through method calls.
Objects can be created from classes.
Examples of objects include a car, a person, or a bank account.
Multi threading is the ability of a program to perform multiple tasks concurrently.
It allows for better utilization of CPU resources
It can improve program performance and responsiveness
Examples include web servers handling multiple requests simultaneously
It requires careful management of shared resources to avoid race conditions
Yes, we can create multiple objects in programming.
Objects are instances of a class.
We can create multiple objects of the same class.
Each object has its own set of instance variables and methods.
Objects can interact with each other through their methods.
Example: creating multiple instances of a 'Person' class for different people.
Encapsulation types are data, procedural and combination.
Data encapsulation hides data from outside world and provides access through methods.
Procedural encapsulation hides implementation details of a procedure.
Combination encapsulation is a mix of data and procedural encapsulation.
Examples include private variables in a class, access modifiers in Java, etc.
Interview experience
Bench Sales Recruiter
9
salaries
| ₹2.5 L/yr - ₹4.2 L/yr |
US IT Recruiter
7
salaries
| ₹3 L/yr - ₹5 L/yr |
Technical Recruiter
6
salaries
| ₹4 L/yr - ₹6 L/yr |
Accounts Manager
5
salaries
| ₹10 L/yr - ₹13 L/yr |
Senior Technical Recruiter
4
salaries
| ₹4 L/yr - ₹5.5 L/yr |
TCS
Infosys
Wipro
HCLTech