
C-Edge Technologies


10+ C-Edge Technologies Java Developer 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. what spring boot annotations you used and how?
I have used annotations like @RestController, @Autowired, @RequestMapping, @Service, @Component, @Repository in Spring Boot.
Used @RestController to define RESTful web services.
Used @Autowired to inject dependencies.
Used @RequestMapping to map web requests to specific handler methods.
Used @Service to mark a class as a service component.
Used @Component to mark a class as a Spring component.
Used @Repository to mark a class as a data access component.
Q4. 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
Q5. 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
Q6. 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
Q7. 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.
Q8. 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
Q9. how to optimize queries
Optimizing queries involves using indexes, limiting result sets, avoiding unnecessary joins, and optimizing database schema.
Use indexes on columns frequently used in WHERE clauses
Limit result sets by using pagination or filtering
Avoid unnecessary joins by denormalizing data or using subqueries
Optimize database schema by reducing redundancy and normalizing data
Q10. what is thread safety
Thread safety ensures that shared data is accessed and modified by multiple threads in a safe and consistent manner.
Thread safety is important in multi-threaded programming to prevent race conditions and ensure data integrity.
It can be achieved through synchronization mechanisms like locks, mutexes, and atomic operations.
For example, using synchronized keyword in Java to protect critical sections of code from concurrent access.
Q11. return type of add method?
The return type of the add method depends on the specific implementation and requirements of the program.
Return type can be int, double, void, or any other data type depending on what the method is supposed to do.
For example, an add method for adding two integers may have a return type of int.
If the add method is simply updating a value and not returning anything, the return type may be void.
Q12. 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];
Q13. 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 C-Edge Technologies Java Developer

Top Java Developer Interview Questions from Similar Companies







Reviews
Interviews
Salaries
Users/Month

