Skip to content

Latest commit

 

History

History
77 lines (74 loc) · 4.49 KB

java-interview-ques.md

File metadata and controls

77 lines (74 loc) · 4.49 KB

Java Interview Questions:

  1. Internal implementation of hashmap, linkedhashmap, treemap, concurrent hashmap and differences b/w them.

  2. Difference b/w Comparable and Comparator

  3. What is Encapsulation and where are you using in your project.

  4. Difference b/w Aggregation, Composition and Inheritance.

  5. What are the design patterns you have used in your project. Explain with programming example

  6. How you can implement Immutable class

  7. Difference b/w transient and volatile keyword.

  8. Singleton breakthrough from serialization. Where Singleton used? Hint: basically transient keyword.

  9. Java 8 streams (convert list into non duplicate list).

  10. Java 8 doesn't have SET and maps.

  11. Difference b/w hashset and hashmap.

  12. Can you create a custom hashmap implementation.

  13. kafka - partitioning.

  14. What is TDD, microservices, CI/CD ?

  15. annotations - qualifier, autowire (where objects stores in spring). Rest API annotations.

  16. Difference b/w spring boot and spring.

  17. What is @transactionalManagement annotation does ?

  18. SOLID principles.

  19. Java 8 streams, optional, functional interface

  20. how to inject bean b having prototype into bean a which is singleton scope. (using xml and annotation both).

  21. Exception handling - catch and finally both have throw exception. which will be thrown?

  22. calling class will implement exception? if child class throw exception in overriden method for both checked and unchecked.

  23. static have a sysout, constructor have sysout, method have sysout. tell the calling sysouts.

  24. GC - all spaces like perm gen and all and how it happens.

  25. What does @Qualifier annotation does ?

  26. serialization - also if serialization have static variable/method what happends and how do we serialize.

  27. What if serialize class have a non- serialized object - will it send over network?

  28. What if serialize class have a child class which is non - serialized and vice versa - what happens?

  29. What is Executor framework.

  30. Arrays.asList(array[]) - what if we will try to add and modify existing data into list. Will the array get impact?

  31. asSynchronized and ... collection class methods use.

  32. fail fast and fail safe iterator. Example of fail safe iterator.

  33. How synchronized keyword used.

  34. String a = new String(""); will go into string pool or heap? if we have this value in heap how will I send it into string pool.

  35. Some multithreading hide problem using some boolean value.. mirroring ya screening karke kuch

  36. Which one is better - linked list or array list and in what cases?

  37. CountdownLatch, concurrency in multithreading, caching,

  38. Callable vs Runnable - what kind of return in callable?

  39. Classloaders and sequence of loading classes.

  40. if I have imported some package and not using it in class. will it gets load?

  41. jms kafka rest api

  42. constructor vs method reference

  43. ACID property

  44. deep cloning and shallow cloning.

  45. What is race confition

  46. What is reiterant lock

  47. What is atomicity ?

  48. hashcode method of hashmap method structure

  49. What is double linked list

  50. For our own thread pool we will go for queue.

  51. G1GC and all methods of GC

  52. What is try with resources ?

  53. What is deep and shalow copy

  54. What is finalize() method.

  55. How hashset internally works?

  56. Singleton(default*) Scopes a single bean definition to a single object instance per Spring IoC container. prototype. Scopes a single bean definition to any number of object instances. request.... session.... global session

  57. Difference b/w primitive data types and Wrapper classes in java.

  58. What is Divide and Conquor approach. Where have you used explain with an example.

  59. What does the add method of ArrayList, HashSet and HashMap returns ?

  60. In which scenario, ArrayList add method returns false ?

  61. Does an abstract class in java have empty or no methods at all ? ---> abstract class A{}

  62. Why we can't create an object of abstract class ?

  63. What is the difference between default and static methods inside interfaces in java 8

  64. What is autoboxing and un-boxing in java ?

  65. Why java have wrapper classes if primitive types were already there ?

  66. What is the difference between a List and a Set ?

  67. What happens when a class is implementing 2 interfaces which is having same default method, how compiler will decide which one to call ? How this ambiguity can be resolved ?

  68. Similar as above instead of default method if we have static method will the behavior is same ?

  69. What are the characteristics of hashmap and what does hash function's return type ?