Java Interview
Java Interview
class A
{
void m1() throws ArrayIndexOutOfBoundsException
{
System.out.println("In m1 A");
}
}
class B extends A
{
void m1() throws IndexOutOfBoundsException
{
System.out.println("In m1 B");
}
}
public class Test {
public static void main(String[] args) {
A a=new B();
a.m1();
}
}
class P
{
void m1()
{
System.out.println("In m1 P");
}
}
class C extends P
{
void m1()
{
System.out.println("In m1 C");
}
void c2()
{
System.out.println("In c2 C");
}
}
public class Test {
public static void main(String[] args) {
P p=new C();
p.c2();
}
}
Class X {
void m1 (Object o) {
System.out.println("from Object ");
}
void m1 (String s) {
System.out.println("from String ");
}
class Y{
public static void main (String args[]) {
X x = new X();
x.m1(null);
}
}
8. Print the emp name whose salary is >10000 in sorted order without any duplicates.
9. What is Circuit breaker.
10. Checked and Unchecked exceptions.
11. Query related to SQL sub query and Joins.
EY -- L1 Java FS
1. SOLID principles in JAVA
2. Design Pattrens
3. Write code to acheive SingleTon Pattren
4. What is Factory Pattren
5. What is Exception handling in Java and its hirerachy
6. How to create Custom UnChecked Exception
7. What will happen if we extend a class with Exception
8. Try with resources in Java
9. What is Polymorphism in Java
10. Method Overloading vs Method Overriding
11. Write a pgm to find length of a String without using length, size
12. Find the num of occurances of each charactor in a string
13. You have 3 threads, once threads complete their execution we need to perform
another operation, how will u write code for this
14. How amany ways to create a Threads
15. Thread vs Runnable
16. JavaScript vs TypeScript
17. Event Loop
18. Call backs
19. Write a query to find 5th Highest sal from Employee table
20. HashMap internal structure
21. HashCode, equals method contrast
22. What will happen if we wont implement hashcode method but implement equals
method
23. Fail-fast vs Fail-safe
24. Iterator in Java
25. How to sort map using values in that
26. How internally lambda expressions work
27. What is Predicate
28. Memory areas of String
29. String Object creation Qns
30. SCP, Heap memory
31. Which are the annotations u have used in springboot
32. What is mean by @SpringBootApplication annotations
33. @Autowured vs @Bean
34. @Component vs @Repository vs @Service
35. What is JPA
36. what is the use of having JPARepository
37. How to write native queries
38. drawbacks of native queries
39. JPQL vs Native query
40. How can we connect different kind of DBs in spingBoot app
41. Comparator vs Comparable
42. write pgm for compareTo, compare methods
EY: L2 - JAVA FS
1. Hogging Threads in Java
2. .equals vs ==
3. What is mean by Pojo class in java
4. What is Observer pattern
5. What do u know about SAGA pattren
6. Why to useKafka
7. Producer and Consumer problem in Java
8. Write a SQL query to highest salary from employee from each dep
9. Write a query to fetch avg salary of an employee whose dep is HR
10. Rotate an array by right using case steps
11. HashMap Internal structure
12. Write a pgm to print length of each string in a list of strings
13. What is inexing in SQL
14. Joins in SQL
15. How many ways we can create strings
16. How the string value store in memory
Genpact - L1 Java FS
1. Which Java8 fetaures u have used in u r project
2. Why default method introduced in Java8
3. What is functional inteface
4. What is Predicate and which method is present in that
5. What is consumer and which method is present in that
6. What is Supplier
7. What is streams and why
8. Why we need to use filter method
9. get the employee obj where emp sal is >50, <90 using streams
10. Which are the annotations u have used in u r project
11. What is @SpringBootAnnotation
12. @Component vs @Service vs @Repository
13. Why we need @Service, @Repository specifically
14. Can we have @Component, @Service at a same time
15. How to execute a method before calling PUT method
class B extnds A{