Ernst & Young
20+ Interview Questions and Answers
Which among String or String Buffer should be preferred when there are lot of updates required to be done in the
data?
What is the @Controller annotation used for? How can you create a controller without an annotation?
What are the advantages of Packages in Java?
How would you differentiate between a String, StringBuffer, and a StringBuilder?
What Are the Basic Annotations that Spring Boot Offers?
Why Java is platform independent and JVM platform dependent?
What are some standard Java pre-defined functional interfaces?
Can you tell the difference between setMaxResults() and setFetchSize() of Query?
What is dependency Injection?
What are the features of a lambda expression?
What does the @SpringBootApplication annotation do internally?
What are the concurrency strategies available in hibernate?
What issues are generally solved by spring clouds?
What is meant by Interface?
Can you tell something about the N+1 SELECT problem in Hibernate?
Explain the use of final keyword in variable, method and class
Difference between Abstract class and Interface.
Explain @RestController annotation in Sprint boot?
Explain the working of Microservice Architecture.
Q20. How can we create our own immutable class
An immutable class in Java can be created by declaring the class as final, making all fields private and final, and not providing any setter methods.
Declare the class as final to prevent inheritance
Make all fields private and final to prevent modification
Do not provide any setter methods to prevent changing the state
Initialize all fields in the constructor
Avoid returning mutable objects or references to internal mutable objects
Q21. Difference between checked and unchecked exceptions.
Checked exceptions are checked at compile-time while unchecked exceptions are not.
Checked exceptions are checked at compile-time and must be handled or declared in the method signature.
Unchecked exceptions are not checked at compile-time and do not need to be handled or declared.
Checked exceptions are usually used for recoverable errors while unchecked exceptions are used for unrecoverable errors.
Examples of checked exceptions include IOException and SQLException while exampl...read more
Q22. How you would connect springboot project with data base.
Use Spring Data JPA to connect Spring Boot project with database.
Add database configuration in application.properties or application.yml file
Create entity classes annotated with @Entity and @Table
Create repository interfaces extending JpaRepository
Use @Autowired annotation to inject repository in services or controllers
Q23. Difference between String and String Builder
String is immutable, StringBuilder is mutable.
String is a sequence of characters stored in the heap memory.
String Builder is a mutable sequence of characters stored in the heap memory.
String objects are immutable, meaning their values cannot be changed once created.
String Builder objects are mutable, meaning their values can be changed after creation.
String concatenation creates a new String object each time, which can be inefficient.
String Builder is more efficient for conca...read more
More about working at Ernst & Young
Interview Process at null
Top Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month