C-Edge Technologies
Interview Questions and Answers
Q1. What is difference between runnable and callable in java?
Runnable is a functional interface with a run() method, while Callable is a functional interface with a call() method that can return a result or throw an exception.
Runnable does not return a result or throw a checked exception, while Callable can return a result or throw a checked exception.
Callable is used in scenarios where you need to return a result or handle checked exceptions, while Runnable is used for simple tasks that do not require a return value.
Example: Runnable ...read more
Q2. How does spring auto configuration works?
Spring auto configuration automatically configures Spring beans based on classpath and property settings.
Spring scans classpath for certain annotations like @Component, @Service, @Repository, @Controller, etc.
Based on these annotations and property settings, Spring automatically configures beans.
Auto configuration can be customized using @Conditional annotations or configuration classes.
Example: @SpringBootApplication annotation triggers auto configuration for Spring Boot app...read more
Q3. Tell me about transaction management in spring.
Transaction management in Spring helps in managing database transactions in a consistent and reliable manner.
Spring provides support for both programmatic and declarative transaction management.
Programmatic transaction management involves handling transactions in code using TransactionTemplate or PlatformTransactionManager.
Declarative transaction management involves using annotations like @Transactional to define transactional behavior at the method or class level.
Spring supp...read more
Q4. Why Strings are immutable in java?
Strings are immutable in Java to ensure thread safety, security, and optimization.
Immutable strings are thread-safe as they cannot be modified concurrently by multiple threads.
Immutable strings enhance security by preventing malicious code from altering the string content.
String interning is possible due to immutability, allowing for memory optimization.
Examples: String str = "Hello"; str.concat(" World"); // This does not modify str, but creates a new string
Q5. What is exception propogation in java?
Exception propagation in Java is the process of passing an exception from one method to another in the call stack.
Exceptions can be thrown in a method and propagated up the call stack until they are caught and handled.
If an exception is not caught in a method, it will be propagated to the calling method.
This continues until the exception is caught or reaches the top of the call stack.
Example: If a method 'A' calls method 'B' and an exception occurs in 'B', it will be propagat...read more
Q6. Expalin JDBC and return type of statement?
JDBC is a Java API for connecting and executing SQL queries on databases. The return type of a statement in JDBC is boolean.
JDBC stands for Java Database Connectivity.
It allows Java programs to interact with databases using SQL queries.
The return type of a statement in JDBC is boolean, indicating whether the query was successfully executed.
Q7. Second level cache in hibernate?
Second level cache in Hibernate is used to cache data at the session factory level to reduce database hits.
Second level cache stores objects across sessions to reduce database calls
Improves performance by reducing database hits
Configurable cache providers like Ehcache, Infinispan can be used
Q8. What are arrays
Arrays are a data structure that stores a collection of elements of the same data type in a contiguous memory location.
Arrays have a fixed size determined at the time of declaration.
Elements in an array are accessed using an index starting from 0.
Example: String[] names = new String[5];
Q9. Data structures in java
Data structures in Java are used to store and organize data efficiently.
Java provides built-in data structures like arrays, lists, sets, maps, queues, and stacks.
Arrays are used to store a fixed-size collection of elements of the same data type.
Lists like ArrayList and LinkedList can dynamically grow and shrink in size.
Sets ensure unique elements and maps store key-value pairs.
Queues follow the FIFO (First In First Out) principle, while stacks follow the LIFO (Last In First O...read more
Interview Process at null
Top Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month