diff --git a/.classpath b/.classpath index d54800d..57bca72 100644 --- a/.classpath +++ b/.classpath @@ -1,6 +1,6 @@ - + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b0aff8e --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +# Ignore all compiled Java class files +*.class +bin/ +.settings/ \ No newline at end of file diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index f2525a8..8c9943d 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=17 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.compliance=17 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -11,4 +11,4 @@ org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning org.eclipse.jdt.core.compiler.release=enabled -org.eclipse.jdt.core.compiler.source=11 +org.eclipse.jdt.core.compiler.source=17 diff --git a/bin/com/academian/AvgOfPostiveNumberArray.class b/bin/com/academian/AvgOfPostiveNumberArray.class deleted file mode 100644 index d41796b..0000000 Binary files a/bin/com/academian/AvgOfPostiveNumberArray.class and /dev/null differ diff --git a/bin/com/academian/ConvertListToMap.class b/bin/com/academian/ConvertListToMap.class deleted file mode 100644 index 346bab8..0000000 Binary files a/bin/com/academian/ConvertListToMap.class and /dev/null differ diff --git a/bin/com/academian/FruitGrouping.class b/bin/com/academian/FruitGrouping.class deleted file mode 100644 index 59e5251..0000000 Binary files a/bin/com/academian/FruitGrouping.class and /dev/null differ diff --git a/bin/com/academian/GfG.class b/bin/com/academian/GfG.class deleted file mode 100644 index 6bd2ecf..0000000 Binary files a/bin/com/academian/GfG.class and /dev/null differ diff --git a/bin/com/academian/HashMapVsIdentyHashMap.class b/bin/com/academian/HashMapVsIdentyHashMap.class deleted file mode 100644 index e6a1e3b..0000000 Binary files a/bin/com/academian/HashMapVsIdentyHashMap.class and /dev/null differ diff --git a/bin/com/academian/Product.class b/bin/com/academian/Product.class deleted file mode 100644 index 56e5736..0000000 Binary files a/bin/com/academian/Product.class and /dev/null differ diff --git a/bin/com/academian/Test.class b/bin/com/academian/Test.class deleted file mode 100644 index fe68445..0000000 Binary files a/bin/com/academian/Test.class and /dev/null differ diff --git a/bin/com/academian/TestM.class b/bin/com/academian/TestM.class deleted file mode 100644 index 53c4bf9..0000000 Binary files a/bin/com/academian/TestM.class and /dev/null differ diff --git a/bin/com/academian/TestMain.class b/bin/com/academian/TestMain.class deleted file mode 100644 index 254c4d8..0000000 Binary files a/bin/com/academian/TestMain.class and /dev/null differ diff --git a/bin/com/academian/ThreadStartTwice.class b/bin/com/academian/ThreadStartTwice.class deleted file mode 100644 index 6ae1a5b..0000000 Binary files a/bin/com/academian/ThreadStartTwice.class and /dev/null differ diff --git a/bin/com/accolite2025/defaultMethodInterface.class b/bin/com/accolite2025/defaultMethodInterface.class deleted file mode 100644 index 3d71d7d..0000000 Binary files a/bin/com/accolite2025/defaultMethodInterface.class and /dev/null differ diff --git a/bin/com/array/ShortArray.class b/bin/com/array/ShortArray.class deleted file mode 100644 index ee1b1f2..0000000 Binary files a/bin/com/array/ShortArray.class and /dev/null differ diff --git a/bin/com/basics/FIndOddEven.class b/bin/com/basics/FIndOddEven.class deleted file mode 100644 index 35cc125..0000000 Binary files a/bin/com/basics/FIndOddEven.class and /dev/null differ diff --git a/bin/com/basics/FibonacciSeries.class b/bin/com/basics/FibonacciSeries.class deleted file mode 100644 index b52f5a8..0000000 Binary files a/bin/com/basics/FibonacciSeries.class and /dev/null differ diff --git a/bin/com/basics/PrimeNumber.class b/bin/com/basics/PrimeNumber.class deleted file mode 100644 index d45cae1..0000000 Binary files a/bin/com/basics/PrimeNumber.class and /dev/null differ diff --git a/bin/com/basics/StringTest.class b/bin/com/basics/StringTest.class deleted file mode 100644 index 90ba0d4..0000000 Binary files a/bin/com/basics/StringTest.class and /dev/null differ diff --git a/bin/com/binary/BinarySearch.class b/bin/com/binary/BinarySearch.class deleted file mode 100644 index 69e7b96..0000000 Binary files a/bin/com/binary/BinarySearch.class and /dev/null differ diff --git a/bin/com/brocode/StackDs.class b/bin/com/brocode/StackDs.class deleted file mode 100644 index 5e3ad90..0000000 Binary files a/bin/com/brocode/StackDs.class and /dev/null differ diff --git a/bin/com/clairvoyant/A.class b/bin/com/clairvoyant/A.class deleted file mode 100644 index 07251ae..0000000 Binary files a/bin/com/clairvoyant/A.class and /dev/null differ diff --git a/bin/com/clairvoyant/B.class b/bin/com/clairvoyant/B.class deleted file mode 100644 index 64dc0c1..0000000 Binary files a/bin/com/clairvoyant/B.class and /dev/null differ diff --git a/bin/com/clairvoyant/C.class b/bin/com/clairvoyant/C.class deleted file mode 100644 index a7dfb09..0000000 Binary files a/bin/com/clairvoyant/C.class and /dev/null differ diff --git a/bin/com/cloneable/ObjectCloneTest.class b/bin/com/cloneable/ObjectCloneTest.class deleted file mode 100644 index 4e6faf4..0000000 Binary files a/bin/com/cloneable/ObjectCloneTest.class and /dev/null differ diff --git a/bin/com/code/decode/Main.class b/bin/com/code/decode/Main.class deleted file mode 100644 index f1ce4e0..0000000 Binary files a/bin/com/code/decode/Main.class and /dev/null differ diff --git a/bin/com/code/decode/comparator/Address.class b/bin/com/code/decode/comparator/Address.class deleted file mode 100644 index 10a4b44..0000000 Binary files a/bin/com/code/decode/comparator/Address.class and /dev/null differ diff --git a/bin/com/code/decode/comparator/AddressComparator.class b/bin/com/code/decode/comparator/AddressComparator.class deleted file mode 100644 index f69cab7..0000000 Binary files a/bin/com/code/decode/comparator/AddressComparator.class and /dev/null differ diff --git a/bin/com/code/decode/comparator/AgeComparator.class b/bin/com/code/decode/comparator/AgeComparator.class deleted file mode 100644 index 22815fa..0000000 Binary files a/bin/com/code/decode/comparator/AgeComparator.class and /dev/null differ diff --git a/bin/com/code/decode/comparator/Employee.class b/bin/com/code/decode/comparator/Employee.class deleted file mode 100644 index 4315058..0000000 Binary files a/bin/com/code/decode/comparator/Employee.class and /dev/null differ diff --git a/bin/com/code/decode/comparator/MainClass.class b/bin/com/code/decode/comparator/MainClass.class deleted file mode 100644 index 89a6204..0000000 Binary files a/bin/com/code/decode/comparator/MainClass.class and /dev/null differ diff --git a/bin/com/code/decode/comparator/NameComparator.class b/bin/com/code/decode/comparator/NameComparator.class deleted file mode 100644 index 4a72064..0000000 Binary files a/bin/com/code/decode/comparator/NameComparator.class and /dev/null differ diff --git a/bin/com/codechef/Stack.class b/bin/com/codechef/Stack.class deleted file mode 100644 index f9368cd..0000000 Binary files a/bin/com/codechef/Stack.class and /dev/null differ diff --git a/bin/com/codechef/StackExample.class b/bin/com/codechef/StackExample.class deleted file mode 100644 index 868725a..0000000 Binary files a/bin/com/codechef/StackExample.class and /dev/null differ diff --git a/bin/com/codinglyf/streams/Employee.class b/bin/com/codinglyf/streams/Employee.class deleted file mode 100644 index 034d7cf..0000000 Binary files a/bin/com/codinglyf/streams/Employee.class and /dev/null differ diff --git a/bin/com/codinglyf/streams/JavaStreamUsages.class b/bin/com/codinglyf/streams/JavaStreamUsages.class deleted file mode 100644 index f79b5b4..0000000 Binary files a/bin/com/codinglyf/streams/JavaStreamUsages.class and /dev/null differ diff --git a/bin/com/codinglyf/streams/Order.class b/bin/com/codinglyf/streams/Order.class deleted file mode 100644 index 3268e01..0000000 Binary files a/bin/com/codinglyf/streams/Order.class and /dev/null differ diff --git a/bin/com/codinglyf/streams/Product.class b/bin/com/codinglyf/streams/Product.class deleted file mode 100644 index 19026d5..0000000 Binary files a/bin/com/codinglyf/streams/Product.class and /dev/null differ diff --git a/bin/com/codinglyf/streams/StreamBeginnerQuestions.class b/bin/com/codinglyf/streams/StreamBeginnerQuestions.class deleted file mode 100644 index c8fff8d..0000000 Binary files a/bin/com/codinglyf/streams/StreamBeginnerQuestions.class and /dev/null differ diff --git a/bin/com/codinglyf/streams/StreamMediumQuestions.class b/bin/com/codinglyf/streams/StreamMediumQuestions.class deleted file mode 100644 index 1658f22..0000000 Binary files a/bin/com/codinglyf/streams/StreamMediumQuestions.class and /dev/null differ diff --git a/bin/com/codinglyf/streams/StreamOnProductOrders.class b/bin/com/codinglyf/streams/StreamOnProductOrders.class deleted file mode 100644 index aa92c68..0000000 Binary files a/bin/com/codinglyf/streams/StreamOnProductOrders.class and /dev/null differ diff --git a/bin/com/codinglyf/streams/StreamScenarioPart1.class b/bin/com/codinglyf/streams/StreamScenarioPart1.class deleted file mode 100644 index 7b7d6e5..0000000 Binary files a/bin/com/codinglyf/streams/StreamScenarioPart1.class and /dev/null differ diff --git a/bin/com/codinglyf/streams/StreamsOnStudentData.class b/bin/com/codinglyf/streams/StreamsOnStudentData.class deleted file mode 100644 index a0462e6..0000000 Binary files a/bin/com/codinglyf/streams/StreamsOnStudentData.class and /dev/null differ diff --git a/bin/com/codinglyf/streams/Student.class b/bin/com/codinglyf/streams/Student.class deleted file mode 100644 index e338d16..0000000 Binary files a/bin/com/codinglyf/streams/Student.class and /dev/null differ diff --git a/bin/com/collection/ReadOnlyCollection.class b/bin/com/collection/ReadOnlyCollection.class deleted file mode 100644 index cc52100..0000000 Binary files a/bin/com/collection/ReadOnlyCollection.class and /dev/null differ diff --git a/bin/com/comparable/Stududent.class b/bin/com/comparable/Stududent.class deleted file mode 100644 index ad00bff..0000000 Binary files a/bin/com/comparable/Stududent.class and /dev/null differ diff --git a/bin/com/compartaor/ComparatorTest.class b/bin/com/compartaor/ComparatorTest.class deleted file mode 100644 index 532a4fb..0000000 Binary files a/bin/com/compartaor/ComparatorTest.class and /dev/null differ diff --git a/bin/com/compartaor/Movie.class b/bin/com/compartaor/Movie.class deleted file mode 100644 index bd3a06b..0000000 Binary files a/bin/com/compartaor/Movie.class and /dev/null differ diff --git a/bin/com/compartaor/MovieNameCompare.class b/bin/com/compartaor/MovieNameCompare.class deleted file mode 100644 index 1d52bb0..0000000 Binary files a/bin/com/compartaor/MovieNameCompare.class and /dev/null differ diff --git a/bin/com/compartaor/RatingCompare.class b/bin/com/compartaor/RatingCompare.class deleted file mode 100644 index ad3816b..0000000 Binary files a/bin/com/compartaor/RatingCompare.class and /dev/null differ diff --git a/bin/com/cuisine/Chinese.class b/bin/com/cuisine/Chinese.class deleted file mode 100644 index 0141ce4..0000000 Binary files a/bin/com/cuisine/Chinese.class and /dev/null differ diff --git a/bin/com/cuisine/Cuisine.class b/bin/com/cuisine/Cuisine.class deleted file mode 100644 index cc95650..0000000 Binary files a/bin/com/cuisine/Cuisine.class and /dev/null differ diff --git a/bin/com/cuisine/FoodFactory.class b/bin/com/cuisine/FoodFactory.class deleted file mode 100644 index dea7f65..0000000 Binary files a/bin/com/cuisine/FoodFactory.class and /dev/null differ diff --git a/bin/com/cuisine/Italian.class b/bin/com/cuisine/Italian.class deleted file mode 100644 index ec535ac..0000000 Binary files a/bin/com/cuisine/Italian.class and /dev/null differ diff --git a/bin/com/cuisine/Japanese.class b/bin/com/cuisine/Japanese.class deleted file mode 100644 index 15e5626..0000000 Binary files a/bin/com/cuisine/Japanese.class and /dev/null differ diff --git a/bin/com/cuisine/Mexican.class b/bin/com/cuisine/Mexican.class deleted file mode 100644 index 12028f8..0000000 Binary files a/bin/com/cuisine/Mexican.class and /dev/null differ diff --git a/bin/com/cuisine/UnservableCuisineRequestException.class b/bin/com/cuisine/UnservableCuisineRequestException.class deleted file mode 100644 index f4bae96..0000000 Binary files a/bin/com/cuisine/UnservableCuisineRequestException.class and /dev/null differ diff --git a/bin/com/divergent2025/A.class b/bin/com/divergent2025/A.class deleted file mode 100644 index 9dbbcfd..0000000 Binary files a/bin/com/divergent2025/A.class and /dev/null differ diff --git a/bin/com/divergent2025/B.class b/bin/com/divergent2025/B.class deleted file mode 100644 index dd5417c..0000000 Binary files a/bin/com/divergent2025/B.class and /dev/null differ diff --git a/bin/com/divergent2025/C.class b/bin/com/divergent2025/C.class deleted file mode 100644 index 710f3b0..0000000 Binary files a/bin/com/divergent2025/C.class and /dev/null differ diff --git a/bin/com/factory/design/pattern/IMobile.class b/bin/com/factory/design/pattern/IMobile.class deleted file mode 100644 index 8b172bd..0000000 Binary files a/bin/com/factory/design/pattern/IMobile.class and /dev/null differ diff --git a/bin/com/factory/design/pattern/Lenovo.class b/bin/com/factory/design/pattern/Lenovo.class deleted file mode 100644 index 565d3f8..0000000 Binary files a/bin/com/factory/design/pattern/Lenovo.class and /dev/null differ diff --git a/bin/com/factory/design/pattern/MobileFactory.class b/bin/com/factory/design/pattern/MobileFactory.class deleted file mode 100644 index a9f10cc..0000000 Binary files a/bin/com/factory/design/pattern/MobileFactory.class and /dev/null differ diff --git a/bin/com/factory/design/pattern/Samsung.class b/bin/com/factory/design/pattern/Samsung.class deleted file mode 100644 index b1eb9c5..0000000 Binary files a/bin/com/factory/design/pattern/Samsung.class and /dev/null differ diff --git a/bin/com/functional/interfacetest/FunctionInterfaceTest.class b/bin/com/functional/interfacetest/FunctionInterfaceTest.class deleted file mode 100644 index 3a02531..0000000 Binary files a/bin/com/functional/interfacetest/FunctionInterfaceTest.class and /dev/null differ diff --git a/bin/com/functional/interfacetest/Maths.class b/bin/com/functional/interfacetest/Maths.class deleted file mode 100644 index b611714..0000000 Binary files a/bin/com/functional/interfacetest/Maths.class and /dev/null differ diff --git a/bin/com/functional/programing/FP01Program.class b/bin/com/functional/programing/FP01Program.class deleted file mode 100644 index 01066ec..0000000 Binary files a/bin/com/functional/programing/FP01Program.class and /dev/null differ diff --git a/bin/com/functional/programing/PlayWithOptionalClass.class b/bin/com/functional/programing/PlayWithOptionalClass.class deleted file mode 100644 index e5c7f58..0000000 Binary files a/bin/com/functional/programing/PlayWithOptionalClass.class and /dev/null differ diff --git a/bin/com/functional/programing/SP01StructuredPrograming.class b/bin/com/functional/programing/SP01StructuredPrograming.class deleted file mode 100644 index 2a1b75e..0000000 Binary files a/bin/com/functional/programing/SP01StructuredPrograming.class and /dev/null differ diff --git a/bin/com/globant/Parent.class b/bin/com/globant/Parent.class deleted file mode 100644 index 04533f5..0000000 Binary files a/bin/com/globant/Parent.class and /dev/null differ diff --git a/bin/com/globant/StringTest.class b/bin/com/globant/StringTest.class deleted file mode 100644 index 9ccae30..0000000 Binary files a/bin/com/globant/StringTest.class and /dev/null differ diff --git a/bin/com/insta/code/Employee.class b/bin/com/insta/code/Employee.class deleted file mode 100644 index e6b21ee..0000000 Binary files a/bin/com/insta/code/Employee.class and /dev/null differ diff --git a/bin/com/insta/code/ShortListUsingLambda.class b/bin/com/insta/code/ShortListUsingLambda.class deleted file mode 100644 index 989414f..0000000 Binary files a/bin/com/insta/code/ShortListUsingLambda.class and /dev/null differ diff --git a/bin/com/interview/AaPractice.class b/bin/com/interview/AaPractice.class new file mode 100644 index 0000000..e64e43e Binary files /dev/null and b/bin/com/interview/AaPractice.class differ diff --git a/bin/com/interviews/AddTwoMatrix.class b/bin/com/interview/AddTwoMatrix.class similarity index 74% rename from bin/com/interviews/AddTwoMatrix.class rename to bin/com/interview/AddTwoMatrix.class index fc74e93..8bcbcdf 100644 Binary files a/bin/com/interviews/AddTwoMatrix.class and b/bin/com/interview/AddTwoMatrix.class differ diff --git a/bin/com/interview/Address.class b/bin/com/interview/Address.class new file mode 100644 index 0000000..832662a Binary files /dev/null and b/bin/com/interview/Address.class differ diff --git a/bin/com/interview/Address1.class b/bin/com/interview/Address1.class new file mode 100644 index 0000000..cffbfc9 Binary files /dev/null and b/bin/com/interview/Address1.class differ diff --git a/bin/com/interview/AddressNonFinal.class b/bin/com/interview/AddressNonFinal.class new file mode 100644 index 0000000..455ef36 Binary files /dev/null and b/bin/com/interview/AddressNonFinal.class differ diff --git a/bin/com/interview/AllInterviewsPrograms.class b/bin/com/interview/AllInterviewsPrograms.class new file mode 100644 index 0000000..42e1ccc Binary files /dev/null and b/bin/com/interview/AllInterviewsPrograms.class differ diff --git a/bin/com/interview/AnagramProgram.class b/bin/com/interview/AnagramProgram.class new file mode 100644 index 0000000..e63fdab Binary files /dev/null and b/bin/com/interview/AnagramProgram.class differ diff --git a/bin/com/interview/CharacterOccuranceCount.class b/bin/com/interview/CharacterOccuranceCount.class new file mode 100644 index 0000000..74ffeee Binary files /dev/null and b/bin/com/interview/CharacterOccuranceCount.class differ diff --git a/bin/com/interview/CheckPalindromStrings.class b/bin/com/interview/CheckPalindromStrings.class new file mode 100644 index 0000000..3b2163b Binary files /dev/null and b/bin/com/interview/CheckPalindromStrings.class differ diff --git a/bin/com/interview/CollectorsExample.class b/bin/com/interview/CollectorsExample.class new file mode 100644 index 0000000..c81bdb9 Binary files /dev/null and b/bin/com/interview/CollectorsExample.class differ diff --git a/bin/com/interview/CompletableFuture1.class b/bin/com/interview/CompletableFuture1.class new file mode 100644 index 0000000..eecbf66 Binary files /dev/null and b/bin/com/interview/CompletableFuture1.class differ diff --git a/bin/com/interview/CompletableFuture2.class b/bin/com/interview/CompletableFuture2.class new file mode 100644 index 0000000..974976d Binary files /dev/null and b/bin/com/interview/CompletableFuture2.class differ diff --git a/bin/com/interview/CompletableFutureDemo.class b/bin/com/interview/CompletableFutureDemo.class new file mode 100644 index 0000000..dd91d0d Binary files /dev/null and b/bin/com/interview/CompletableFutureDemo.class differ diff --git a/bin/com/interviews/ConvertHashMapToArrayList.class b/bin/com/interview/ConvertHashMapToArrayList.class similarity index 91% rename from bin/com/interviews/ConvertHashMapToArrayList.class rename to bin/com/interview/ConvertHashMapToArrayList.class index c1b632a..ff4f5aa 100644 Binary files a/bin/com/interviews/ConvertHashMapToArrayList.class and b/bin/com/interview/ConvertHashMapToArrayList.class differ diff --git a/bin/com/interview/ConvertIntegerToBinary.class b/bin/com/interview/ConvertIntegerToBinary.class new file mode 100644 index 0000000..1c7ea91 Binary files /dev/null and b/bin/com/interview/ConvertIntegerToBinary.class differ diff --git a/bin/com/interview/java/eight/CountCharacterBySequence.class b/bin/com/interview/CountCharacterBySequence.class similarity index 90% rename from bin/com/interview/java/eight/CountCharacterBySequence.class rename to bin/com/interview/CountCharacterBySequence.class index 26f7dec..211c0ca 100644 Binary files a/bin/com/interview/java/eight/CountCharacterBySequence.class and b/bin/com/interview/CountCharacterBySequence.class differ diff --git a/bin/com/interviews/CountStringWithSequence.class b/bin/com/interview/CountStringWithSequence.class similarity index 81% rename from bin/com/interviews/CountStringWithSequence.class rename to bin/com/interview/CountStringWithSequence.class index ca080b1..9bc7c03 100644 Binary files a/bin/com/interviews/CountStringWithSequence.class and b/bin/com/interview/CountStringWithSequence.class differ diff --git a/bin/com/interview/CountVowelsAndIntervalStringPairs.class b/bin/com/interview/CountVowelsAndIntervalStringPairs.class new file mode 100644 index 0000000..2066e82 Binary files /dev/null and b/bin/com/interview/CountVowelsAndIntervalStringPairs.class differ diff --git a/bin/com/interview/java/eight/CountWordOccurance.class b/bin/com/interview/CountWordOccurance.class similarity index 87% rename from bin/com/interview/java/eight/CountWordOccurance.class rename to bin/com/interview/CountWordOccurance.class index 76adba2..f48438c 100644 Binary files a/bin/com/interview/java/eight/CountWordOccurance.class and b/bin/com/interview/CountWordOccurance.class differ diff --git a/bin/com/interviews/CreateImmutableClass.class b/bin/com/interview/CreateImmutableClass.class similarity index 81% rename from bin/com/interviews/CreateImmutableClass.class rename to bin/com/interview/CreateImmutableClass.class index 0305f9a..0ae46b3 100644 Binary files a/bin/com/interviews/CreateImmutableClass.class and b/bin/com/interview/CreateImmutableClass.class differ diff --git a/bin/com/interview/CustomImmutableClass.class b/bin/com/interview/CustomImmutableClass.class new file mode 100644 index 0000000..3db7142 Binary files /dev/null and b/bin/com/interview/CustomImmutableClass.class differ diff --git a/bin/com/interview/CustomImmutableClassWithoutFinal.class b/bin/com/interview/CustomImmutableClassWithoutFinal.class new file mode 100644 index 0000000..e861409 Binary files /dev/null and b/bin/com/interview/CustomImmutableClassWithoutFinal.class differ diff --git a/bin/com/interviews/Employee.class b/bin/com/interview/Employee.class similarity index 72% rename from bin/com/interviews/Employee.class rename to bin/com/interview/Employee.class index 6488021..adeb96c 100644 Binary files a/bin/com/interviews/Employee.class and b/bin/com/interview/Employee.class differ diff --git a/bin/com/interview/Employee1.class b/bin/com/interview/Employee1.class new file mode 100644 index 0000000..23b73ca Binary files /dev/null and b/bin/com/interview/Employee1.class differ diff --git a/bin/com/interview/EmployeeFinal.class b/bin/com/interview/EmployeeFinal.class new file mode 100644 index 0000000..b729ccb Binary files /dev/null and b/bin/com/interview/EmployeeFinal.class differ diff --git a/bin/com/interview/EmployeeImmutable.class b/bin/com/interview/EmployeeImmutable.class new file mode 100644 index 0000000..520c558 Binary files /dev/null and b/bin/com/interview/EmployeeImmutable.class differ diff --git a/bin/com/interview/java/eight/Employees.class b/bin/com/interview/Employees.class similarity index 72% rename from bin/com/interview/java/eight/Employees.class rename to bin/com/interview/Employees.class index 49b66ae..fb03866 100644 Binary files a/bin/com/interview/java/eight/Employees.class and b/bin/com/interview/Employees.class differ diff --git a/bin/com/interview/ExecutorsExample.class b/bin/com/interview/ExecutorsExample.class new file mode 100644 index 0000000..b87c479 Binary files /dev/null and b/bin/com/interview/ExecutorsExample.class differ diff --git a/bin/com/interview/FinalClassExample.class b/bin/com/interview/FinalClassExample.class new file mode 100644 index 0000000..407c9e1 Binary files /dev/null and b/bin/com/interview/FinalClassExample.class differ diff --git a/bin/com/interview/FindDuplicateCharacterFromString.class b/bin/com/interview/FindDuplicateCharacterFromString.class new file mode 100644 index 0000000..a6b7237 Binary files /dev/null and b/bin/com/interview/FindDuplicateCharacterFromString.class differ diff --git a/bin/com/interview/FindDuplicateFromArrayList.class b/bin/com/interview/FindDuplicateFromArrayList.class new file mode 100644 index 0000000..5976077 Binary files /dev/null and b/bin/com/interview/FindDuplicateFromArrayList.class differ diff --git a/bin/com/interviews/FindLessThen9000SalaryDepartmentWise.class b/bin/com/interview/FindLessThen9000SalaryDepartmentWise.class similarity index 61% rename from bin/com/interviews/FindLessThen9000SalaryDepartmentWise.class rename to bin/com/interview/FindLessThen9000SalaryDepartmentWise.class index 8ae3c83..a5d42e8 100644 Binary files a/bin/com/interviews/FindLessThen9000SalaryDepartmentWise.class and b/bin/com/interview/FindLessThen9000SalaryDepartmentWise.class differ diff --git a/bin/com/interview/FindLongestSubString.class b/bin/com/interview/FindLongestSubString.class new file mode 100644 index 0000000..0744b29 Binary files /dev/null and b/bin/com/interview/FindLongestSubString.class differ diff --git a/bin/com/interview/FindSecondMaxFromArray.class b/bin/com/interview/FindSecondMaxFromArray.class new file mode 100644 index 0000000..6ef9e37 Binary files /dev/null and b/bin/com/interview/FindSecondMaxFromArray.class differ diff --git a/bin/com/interviews/FindTheAverageOfListElements.class b/bin/com/interview/FindTheAverageOfListElements.class similarity index 89% rename from bin/com/interviews/FindTheAverageOfListElements.class rename to bin/com/interview/FindTheAverageOfListElements.class index 939adec..f1f65b0 100644 Binary files a/bin/com/interviews/FindTheAverageOfListElements.class and b/bin/com/interview/FindTheAverageOfListElements.class differ diff --git a/bin/com/interview/FindTheTargetOfSumValues.class b/bin/com/interview/FindTheTargetOfSumValues.class new file mode 100644 index 0000000..2c29449 Binary files /dev/null and b/bin/com/interview/FindTheTargetOfSumValues.class differ diff --git a/bin/com/interview/FutureVsCompletableFuture.class b/bin/com/interview/FutureVsCompletableFuture.class new file mode 100644 index 0000000..360cf08 Binary files /dev/null and b/bin/com/interview/FutureVsCompletableFuture.class differ diff --git a/bin/com/interviews/GetMaxAgeOfPerson.class b/bin/com/interview/GetMaxAgeOfPerson.class similarity index 73% rename from bin/com/interviews/GetMaxAgeOfPerson.class rename to bin/com/interview/GetMaxAgeOfPerson.class index 8dba46b..ec735d4 100644 Binary files a/bin/com/interviews/GetMaxAgeOfPerson.class and b/bin/com/interview/GetMaxAgeOfPerson.class differ diff --git a/bin/com/interviews/GetStudentStatesWise.class b/bin/com/interview/GetStudentStatesWise.class similarity index 73% rename from bin/com/interviews/GetStudentStatesWise.class rename to bin/com/interview/GetStudentStatesWise.class index 3a84efd..2ec9383 100644 Binary files a/bin/com/interviews/GetStudentStatesWise.class and b/bin/com/interview/GetStudentStatesWise.class differ diff --git a/bin/com/interview/MajorityElementWith.class b/bin/com/interview/MajorityElementWith.class new file mode 100644 index 0000000..71d8fee Binary files /dev/null and b/bin/com/interview/MajorityElementWith.class differ diff --git a/bin/com/interviews/MapOperationByJavaEight_8.class b/bin/com/interview/MapOperationByJavaEight_8.class similarity index 85% rename from bin/com/interviews/MapOperationByJavaEight_8.class rename to bin/com/interview/MapOperationByJavaEight_8.class index 7713111..277fb2d 100644 Binary files a/bin/com/interviews/MapOperationByJavaEight_8.class and b/bin/com/interview/MapOperationByJavaEight_8.class differ diff --git a/bin/com/interviews/MapVsFlatMap.class b/bin/com/interview/MapVsFlatMap.class similarity index 93% rename from bin/com/interviews/MapVsFlatMap.class rename to bin/com/interview/MapVsFlatMap.class index db3d38f..240e47e 100644 Binary files a/bin/com/interviews/MapVsFlatMap.class and b/bin/com/interview/MapVsFlatMap.class differ diff --git a/bin/com/interview/MemoryStructureAnalyzer.class b/bin/com/interview/MemoryStructureAnalyzer.class new file mode 100644 index 0000000..bad64f7 Binary files /dev/null and b/bin/com/interview/MemoryStructureAnalyzer.class differ diff --git a/bin/com/interview/MergeTwoListAndFindCommonValues.class b/bin/com/interview/MergeTwoListAndFindCommonValues.class new file mode 100644 index 0000000..843ed46 Binary files /dev/null and b/bin/com/interview/MergeTwoListAndFindCommonValues.class differ diff --git a/bin/com/interview/MethodChainingPerson.class b/bin/com/interview/MethodChainingPerson.class new file mode 100644 index 0000000..78897e8 Binary files /dev/null and b/bin/com/interview/MethodChainingPerson.class differ diff --git a/bin/com/interview/MethodReference.class b/bin/com/interview/MethodReference.class new file mode 100644 index 0000000..37cd21b Binary files /dev/null and b/bin/com/interview/MethodReference.class differ diff --git a/bin/com/interview/MoveArrayZerosToRight.class b/bin/com/interview/MoveArrayZerosToRight.class new file mode 100644 index 0000000..1550468 Binary files /dev/null and b/bin/com/interview/MoveArrayZerosToRight.class differ diff --git a/bin/com/interviews/ObjectAsAKeyInHashMap.class b/bin/com/interview/ObjectAsAKeyInHashMap.class similarity index 73% rename from bin/com/interviews/ObjectAsAKeyInHashMap.class rename to bin/com/interview/ObjectAsAKeyInHashMap.class index 7b8a8c4..e661d07 100644 Binary files a/bin/com/interviews/ObjectAsAKeyInHashMap.class and b/bin/com/interview/ObjectAsAKeyInHashMap.class differ diff --git a/bin/com/interview/java/eight/OptinalExample.class b/bin/com/interview/OptinalExample.class similarity index 83% rename from bin/com/interview/java/eight/OptinalExample.class rename to bin/com/interview/OptinalExample.class index e565f5f..c7c860d 100644 Binary files a/bin/com/interview/java/eight/OptinalExample.class and b/bin/com/interview/OptinalExample.class differ diff --git a/bin/com/interview/Order.class b/bin/com/interview/Order.class new file mode 100644 index 0000000..29409e1 Binary files /dev/null and b/bin/com/interview/Order.class differ diff --git a/bin/com/interviews/PrimeNumberFind.class b/bin/com/interview/PrimeNumberFind.class similarity index 80% rename from bin/com/interviews/PrimeNumberFind.class rename to bin/com/interview/PrimeNumberFind.class index b03aee6..66ef0d2 100644 Binary files a/bin/com/interviews/PrimeNumberFind.class and b/bin/com/interview/PrimeNumberFind.class differ diff --git a/bin/com/interview/java/eight/PrintOnlyDuplicateValuesUsingJavaEight.class b/bin/com/interview/PrintOnlyDuplicateValuesUsingJavaEight.class similarity index 88% rename from bin/com/interview/java/eight/PrintOnlyDuplicateValuesUsingJavaEight.class rename to bin/com/interview/PrintOnlyDuplicateValuesUsingJavaEight.class index 820653b..6de6088 100644 Binary files a/bin/com/interview/java/eight/PrintOnlyDuplicateValuesUsingJavaEight.class and b/bin/com/interview/PrintOnlyDuplicateValuesUsingJavaEight.class differ diff --git a/bin/com/interviews/Product.class b/bin/com/interview/Product.class similarity index 62% rename from bin/com/interviews/Product.class rename to bin/com/interview/Product.class index 84d30d4..b25d25c 100644 Binary files a/bin/com/interviews/Product.class and b/bin/com/interview/Product.class differ diff --git a/bin/com/interview/ProductCollect.class b/bin/com/interview/ProductCollect.class new file mode 100644 index 0000000..4b70a41 Binary files /dev/null and b/bin/com/interview/ProductCollect.class differ diff --git a/bin/com/interview/ReentrantLockExample.class b/bin/com/interview/ReentrantLockExample.class new file mode 100644 index 0000000..fbaece2 Binary files /dev/null and b/bin/com/interview/ReentrantLockExample.class differ diff --git a/bin/com/interview/ReentrantLockVsSynchronizedExample.class b/bin/com/interview/ReentrantLockVsSynchronizedExample.class new file mode 100644 index 0000000..81f5828 Binary files /dev/null and b/bin/com/interview/ReentrantLockVsSynchronizedExample.class differ diff --git a/bin/com/interview/java/eight/RemoveDuplicates.class b/bin/com/interview/RemoveDuplicates.class similarity index 79% rename from bin/com/interview/java/eight/RemoveDuplicates.class rename to bin/com/interview/RemoveDuplicates.class index 366b867..3809466 100644 Binary files a/bin/com/interview/java/eight/RemoveDuplicates.class and b/bin/com/interview/RemoveDuplicates.class differ diff --git a/bin/com/interview/RemoveLaptopWordFromProduct.class b/bin/com/interview/RemoveLaptopWordFromProduct.class new file mode 100644 index 0000000..768c45d Binary files /dev/null and b/bin/com/interview/RemoveLaptopWordFromProduct.class differ diff --git a/bin/com/interview/ReturnSumArrayOfNumber.class b/bin/com/interview/ReturnSumArrayOfNumber.class new file mode 100644 index 0000000..71f9179 Binary files /dev/null and b/bin/com/interview/ReturnSumArrayOfNumber.class differ diff --git a/bin/com/interview/java/eight/SequencialyCountCharatersAndMostOccurance.class b/bin/com/interview/SequencialyCountCharatersAndMostOccurance.class similarity index 83% rename from bin/com/interview/java/eight/SequencialyCountCharatersAndMostOccurance.class rename to bin/com/interview/SequencialyCountCharatersAndMostOccurance.class index 3ae89c0..cb0452a 100644 Binary files a/bin/com/interview/java/eight/SequencialyCountCharatersAndMostOccurance.class and b/bin/com/interview/SequencialyCountCharatersAndMostOccurance.class differ diff --git a/bin/com/interview/SeriesGenerator.class b/bin/com/interview/SeriesGenerator.class new file mode 100644 index 0000000..ab1a959 Binary files /dev/null and b/bin/com/interview/SeriesGenerator.class differ diff --git a/bin/com/interview/ShortEmployeeAddress.class b/bin/com/interview/ShortEmployeeAddress.class new file mode 100644 index 0000000..8231645 Binary files /dev/null and b/bin/com/interview/ShortEmployeeAddress.class differ diff --git a/bin/com/interviews/ShortMapByValues.class b/bin/com/interview/ShortMapByValues.class similarity index 93% rename from bin/com/interviews/ShortMapByValues.class rename to bin/com/interview/ShortMapByValues.class index 08fbcd7..555cfbb 100644 Binary files a/bin/com/interviews/ShortMapByValues.class and b/bin/com/interview/ShortMapByValues.class differ diff --git a/bin/com/interview/ShortStudentByRollNumber.class b/bin/com/interview/ShortStudentByRollNumber.class new file mode 100644 index 0000000..0d5be38 Binary files /dev/null and b/bin/com/interview/ShortStudentByRollNumber.class differ diff --git a/bin/com/interview/java/eight/SingletonClass.class b/bin/com/interview/SingletonClass.class similarity index 82% rename from bin/com/interview/java/eight/SingletonClass.class rename to bin/com/interview/SingletonClass.class index 4ead17d..6ca6242 100644 Binary files a/bin/com/interview/java/eight/SingletonClass.class and b/bin/com/interview/SingletonClass.class differ diff --git a/bin/com/interviews/SingletonExample.class b/bin/com/interview/SingletonExample.class similarity index 79% rename from bin/com/interviews/SingletonExample.class rename to bin/com/interview/SingletonExample.class index 35f08dd..00ecdd5 100644 Binary files a/bin/com/interviews/SingletonExample.class and b/bin/com/interview/SingletonExample.class differ diff --git a/bin/com/interview/java/eight/StreamJavaEightPractice.class b/bin/com/interview/StreamJavaEightPractice.class similarity index 96% rename from bin/com/interview/java/eight/StreamJavaEightPractice.class rename to bin/com/interview/StreamJavaEightPractice.class index d23b4f8..6271831 100644 Binary files a/bin/com/interview/java/eight/StreamJavaEightPractice.class and b/bin/com/interview/StreamJavaEightPractice.class differ diff --git a/bin/com/interview/StringCompare.class b/bin/com/interview/StringCompare.class new file mode 100644 index 0000000..2941802 Binary files /dev/null and b/bin/com/interview/StringCompare.class differ diff --git a/bin/com/interviews/StringOcuuranceCounting.class b/bin/com/interview/StringOcuuranceCounting.class similarity index 89% rename from bin/com/interviews/StringOcuuranceCounting.class rename to bin/com/interview/StringOcuuranceCounting.class index 7c4069e..776e153 100644 Binary files a/bin/com/interviews/StringOcuuranceCounting.class and b/bin/com/interview/StringOcuuranceCounting.class differ diff --git a/bin/com/interview/java/eight/StringPrefixFilter.class b/bin/com/interview/StringPrefixFilter.class similarity index 83% rename from bin/com/interview/java/eight/StringPrefixFilter.class rename to bin/com/interview/StringPrefixFilter.class index c0bfd22..c91845a 100644 Binary files a/bin/com/interview/java/eight/StringPrefixFilter.class and b/bin/com/interview/StringPrefixFilter.class differ diff --git a/bin/com/interviews/Student.class b/bin/com/interview/Student.class similarity index 72% rename from bin/com/interviews/Student.class rename to bin/com/interview/Student.class index a464740..4b8bb18 100644 Binary files a/bin/com/interviews/Student.class and b/bin/com/interview/Student.class differ diff --git a/bin/com/interview/SynchronizedExample.class b/bin/com/interview/SynchronizedExample.class new file mode 100644 index 0000000..2c744fc Binary files /dev/null and b/bin/com/interview/SynchronizedExample.class differ diff --git a/bin/com/interview/java/eight/ThirdLargestSalary.class b/bin/com/interview/ThirdLargestSalary.class similarity index 80% rename from bin/com/interview/java/eight/ThirdLargestSalary.class rename to bin/com/interview/ThirdLargestSalary.class index d6ff40b..e1ad4e9 100644 Binary files a/bin/com/interview/java/eight/ThirdLargestSalary.class and b/bin/com/interview/ThirdLargestSalary.class differ diff --git a/bin/com/interviews/TreeSetSequence.class b/bin/com/interview/TreeSetSequence.class similarity index 84% rename from bin/com/interviews/TreeSetSequence.class rename to bin/com/interview/TreeSetSequence.class index 21245f7..4f5fa80 100644 Binary files a/bin/com/interviews/TreeSetSequence.class and b/bin/com/interview/TreeSetSequence.class differ diff --git a/bin/com/interview/UniqueStudentExams$Student.class b/bin/com/interview/UniqueStudentExams$Student.class new file mode 100644 index 0000000..0c2ba53 Binary files /dev/null and b/bin/com/interview/UniqueStudentExams$Student.class differ diff --git a/bin/com/interview/UniqueStudentExams$StudentExamRecord.class b/bin/com/interview/UniqueStudentExams$StudentExamRecord.class new file mode 100644 index 0000000..b43e661 Binary files /dev/null and b/bin/com/interview/UniqueStudentExams$StudentExamRecord.class differ diff --git a/bin/com/interview/UniqueStudentExams.class b/bin/com/interview/UniqueStudentExams.class new file mode 100644 index 0000000..c067160 Binary files /dev/null and b/bin/com/interview/UniqueStudentExams.class differ diff --git a/bin/com/interviews/UseOfFinalClass.class b/bin/com/interview/UseOfFinalClass.class similarity index 65% rename from bin/com/interviews/UseOfFinalClass.class rename to bin/com/interview/UseOfFinalClass.class index 156b4e0..b60133a 100644 Binary files a/bin/com/interviews/UseOfFinalClass.class and b/bin/com/interview/UseOfFinalClass.class differ diff --git a/bin/com/interview/all/A.class b/bin/com/interview/all/A.class new file mode 100644 index 0000000..80cf6d0 Binary files /dev/null and b/bin/com/interview/all/A.class differ diff --git a/bin/com/interview/all/Aclairvoyant.class b/bin/com/interview/all/Aclairvoyant.class new file mode 100644 index 0000000..507797c Binary files /dev/null and b/bin/com/interview/all/Aclairvoyant.class differ diff --git a/bin/com/interview/josh/Addable.class b/bin/com/interview/all/Addable.class similarity index 68% rename from bin/com/interview/josh/Addable.class rename to bin/com/interview/all/Addable.class index 07ceaa4..7b52da3 100644 Binary files a/bin/com/interview/josh/Addable.class and b/bin/com/interview/all/Addable.class differ diff --git a/bin/com/interview/all/Address.class b/bin/com/interview/all/Address.class new file mode 100644 index 0000000..8a0312e Binary files /dev/null and b/bin/com/interview/all/Address.class differ diff --git a/bin/com/interview/all/AllPrograms$1.class b/bin/com/interview/all/AllPrograms$1.class index 4164cae..26f1776 100644 Binary files a/bin/com/interview/all/AllPrograms$1.class and b/bin/com/interview/all/AllPrograms$1.class differ diff --git a/bin/com/interview/all/AllPrograms.class b/bin/com/interview/all/AllPrograms.class index cae607e..537b658 100644 Binary files a/bin/com/interview/all/AllPrograms.class and b/bin/com/interview/all/AllPrograms.class differ diff --git a/bin/com/interview/all/ArrayOpearations.class b/bin/com/interview/all/ArrayOpearations.class new file mode 100644 index 0000000..fb8f199 Binary files /dev/null and b/bin/com/interview/all/ArrayOpearations.class differ diff --git a/bin/com/interview/all/B.class b/bin/com/interview/all/B.class new file mode 100644 index 0000000..491205a Binary files /dev/null and b/bin/com/interview/all/B.class differ diff --git a/bin/com/interview/all/Bclairvoyant.class b/bin/com/interview/all/Bclairvoyant.class new file mode 100644 index 0000000..5897982 Binary files /dev/null and b/bin/com/interview/all/Bclairvoyant.class differ diff --git a/bin/com/interview/techmahindra/CalculateValueOfPiUsingFirstNGivenFormula.class b/bin/com/interview/all/CalculateValueOfPiUsingFirstNGivenFormula.class similarity index 59% rename from bin/com/interview/techmahindra/CalculateValueOfPiUsingFirstNGivenFormula.class rename to bin/com/interview/all/CalculateValueOfPiUsingFirstNGivenFormula.class index fbc491e..62c8330 100644 Binary files a/bin/com/interview/techmahindra/CalculateValueOfPiUsingFirstNGivenFormula.class and b/bin/com/interview/all/CalculateValueOfPiUsingFirstNGivenFormula.class differ diff --git a/bin/com/interview/all/CallMainMethodUsingInterface.class b/bin/com/interview/all/CallMainMethodUsingInterface.class new file mode 100644 index 0000000..4083daf Binary files /dev/null and b/bin/com/interview/all/CallMainMethodUsingInterface.class differ diff --git a/bin/com/interview/capgamini052024/CallableInterface.class b/bin/com/interview/all/CallableInterface.class similarity index 87% rename from bin/com/interview/capgamini052024/CallableInterface.class rename to bin/com/interview/all/CallableInterface.class index 346820f..1189373 100644 Binary files a/bin/com/interview/capgamini052024/CallableInterface.class and b/bin/com/interview/all/CallableInterface.class differ diff --git a/bin/com/interview/all/Cclairvoyant.class b/bin/com/interview/all/Cclairvoyant.class new file mode 100644 index 0000000..e015b69 Binary files /dev/null and b/bin/com/interview/all/Cclairvoyant.class differ diff --git a/bin/com/globant/Chield.class b/bin/com/interview/all/Chield.class similarity index 52% rename from bin/com/globant/Chield.class rename to bin/com/interview/all/Chield.class index 1e91af3..cfacb5d 100644 Binary files a/bin/com/globant/Chield.class and b/bin/com/interview/all/Chield.class differ diff --git a/bin/com/interview/interview/Child.class b/bin/com/interview/all/Childi.class similarity index 69% rename from bin/com/interview/interview/Child.class rename to bin/com/interview/all/Childi.class index f6fe3c2..f1164a1 100644 Binary files a/bin/com/interview/interview/Child.class and b/bin/com/interview/all/Childi.class differ diff --git a/bin/com/interview/all/Chinese.class b/bin/com/interview/all/Chinese.class new file mode 100644 index 0000000..a718a27 Binary files /dev/null and b/bin/com/interview/all/Chinese.class differ diff --git a/bin/com/interview/capgamini052024/ComparableComparatorTest.class b/bin/com/interview/all/ComparableComparatorTest.class similarity index 67% rename from bin/com/interview/capgamini052024/ComparableComparatorTest.class rename to bin/com/interview/all/ComparableComparatorTest.class index be6587b..7f77fcd 100644 Binary files a/bin/com/interview/capgamini052024/ComparableComparatorTest.class and b/bin/com/interview/all/ComparableComparatorTest.class differ diff --git a/bin/com/interview/capgamini052024/ComparableTest.class b/bin/com/interview/all/ComparableTest.class similarity index 77% rename from bin/com/interview/capgamini052024/ComparableTest.class rename to bin/com/interview/all/ComparableTest.class index f1e7773..cc300fa 100644 Binary files a/bin/com/interview/capgamini052024/ComparableTest.class and b/bin/com/interview/all/ComparableTest.class differ diff --git a/bin/com/interview/capgamini052024/ComparatorTests.class b/bin/com/interview/all/ComparatorTests.class similarity index 66% rename from bin/com/interview/capgamini052024/ComparatorTests.class rename to bin/com/interview/all/ComparatorTests.class index c57237e..2a50300 100644 Binary files a/bin/com/interview/capgamini052024/ComparatorTests.class and b/bin/com/interview/all/ComparatorTests.class differ diff --git a/bin/com/interview/capgamini052024/CountCharacterSequencialy.class b/bin/com/interview/all/CountCharacterSequencialy.class similarity index 87% rename from bin/com/interview/capgamini052024/CountCharacterSequencialy.class rename to bin/com/interview/all/CountCharacterSequencialy.class index ed416e2..b0cabd0 100644 Binary files a/bin/com/interview/capgamini052024/CountCharacterSequencialy.class and b/bin/com/interview/all/CountCharacterSequencialy.class differ diff --git a/bin/com/interview/all/CountWordOccuranceNormally.class b/bin/com/interview/all/CountWordOccuranceNormally.class new file mode 100644 index 0000000..58c6d5f Binary files /dev/null and b/bin/com/interview/all/CountWordOccuranceNormally.class differ diff --git a/bin/com/interview/josh/CreateFunctionalInterfaeAndApplyUsingLamdaExpression.class b/bin/com/interview/all/CreateFunctionalInterfaeAndApplyUsingLamdaExpression.class similarity index 63% rename from bin/com/interview/josh/CreateFunctionalInterfaeAndApplyUsingLamdaExpression.class rename to bin/com/interview/all/CreateFunctionalInterfaeAndApplyUsingLamdaExpression.class index bd6153c..47573b8 100644 Binary files a/bin/com/interview/josh/CreateFunctionalInterfaeAndApplyUsingLamdaExpression.class and b/bin/com/interview/all/CreateFunctionalInterfaeAndApplyUsingLamdaExpression.class differ diff --git a/bin/com/interview/all/Cuisine.class b/bin/com/interview/all/Cuisine.class new file mode 100644 index 0000000..b974028 Binary files /dev/null and b/bin/com/interview/all/Cuisine.class differ diff --git a/bin/com/interview/all/DIvergentC.class b/bin/com/interview/all/DIvergentC.class new file mode 100644 index 0000000..72d31da Binary files /dev/null and b/bin/com/interview/all/DIvergentC.class differ diff --git a/bin/com/interview/all/DeepCopyDemo.class b/bin/com/interview/all/DeepCopyDemo.class new file mode 100644 index 0000000..67c0b54 Binary files /dev/null and b/bin/com/interview/all/DeepCopyDemo.class differ diff --git a/bin/com/interview/all/Department.class b/bin/com/interview/all/Department.class new file mode 100644 index 0000000..5f56e5e Binary files /dev/null and b/bin/com/interview/all/Department.class differ diff --git a/bin/com/divergent2025/Test.class b/bin/com/interview/all/DivergentTest.class similarity index 72% rename from bin/com/divergent2025/Test.class rename to bin/com/interview/all/DivergentTest.class index 2d93792..5f8264e 100644 Binary files a/bin/com/divergent2025/Test.class and b/bin/com/interview/all/DivergentTest.class differ diff --git a/bin/com/interview/all/EmpTreeSet.class b/bin/com/interview/all/EmpTreeSet.class new file mode 100644 index 0000000..ad0a72f Binary files /dev/null and b/bin/com/interview/all/EmpTreeSet.class differ diff --git a/bin/com/interview/capgamini052024/Employee.class b/bin/com/interview/all/Employee.class similarity index 65% rename from bin/com/interview/capgamini052024/Employee.class rename to bin/com/interview/all/Employee.class index 447971f..75f4688 100644 Binary files a/bin/com/interview/capgamini052024/Employee.class and b/bin/com/interview/all/Employee.class differ diff --git a/bin/com/interview/all/EmployeeDeep.class b/bin/com/interview/all/EmployeeDeep.class new file mode 100644 index 0000000..4b981b9 Binary files /dev/null and b/bin/com/interview/all/EmployeeDeep.class differ diff --git a/bin/com/interview/all/FIndFirstNonReapitingCharacter.class b/bin/com/interview/all/FIndFirstNonReapitingCharacter.class new file mode 100644 index 0000000..e737402 Binary files /dev/null and b/bin/com/interview/all/FIndFirstNonReapitingCharacter.class differ diff --git a/bin/com/interview/all/FindDuplicateFromList.class b/bin/com/interview/all/FindDuplicateFromList.class new file mode 100644 index 0000000..45f0d8e Binary files /dev/null and b/bin/com/interview/all/FindDuplicateFromList.class differ diff --git a/bin/com/interview/all/FindMostOccuranceCharacter.class b/bin/com/interview/all/FindMostOccuranceCharacter.class new file mode 100644 index 0000000..c8f146e Binary files /dev/null and b/bin/com/interview/all/FindMostOccuranceCharacter.class differ diff --git a/bin/com/interview/all/FindMostOccurenceDigitFromList.class b/bin/com/interview/all/FindMostOccurenceDigitFromList.class new file mode 100644 index 0000000..0e6317d Binary files /dev/null and b/bin/com/interview/all/FindMostOccurenceDigitFromList.class differ diff --git a/bin/com/interview/volkasvegon/FindMostReapetedStringFormArray.class b/bin/com/interview/all/FindMostReapetedStringFormArray.class similarity index 91% rename from bin/com/interview/volkasvegon/FindMostReapetedStringFormArray.class rename to bin/com/interview/all/FindMostReapetedStringFormArray.class index 03b3cba..684a020 100644 Binary files a/bin/com/interview/volkasvegon/FindMostReapetedStringFormArray.class and b/bin/com/interview/all/FindMostReapetedStringFormArray.class differ diff --git a/bin/com/interview/all/FindNonReapititiveCharacter.class b/bin/com/interview/all/FindNonReapititiveCharacter.class new file mode 100644 index 0000000..0b60e73 Binary files /dev/null and b/bin/com/interview/all/FindNonReapititiveCharacter.class differ diff --git a/bin/com/interview/ili/lilly/FindSalayLeassThan90000AndGropByDepartment.class b/bin/com/interview/all/FindSalayLeassThan90000AndGropByDepartment.class similarity index 91% rename from bin/com/interview/ili/lilly/FindSalayLeassThan90000AndGropByDepartment.class rename to bin/com/interview/all/FindSalayLeassThan90000AndGropByDepartment.class index 11f29b3..2fe7bf9 100644 Binary files a/bin/com/interview/ili/lilly/FindSalayLeassThan90000AndGropByDepartment.class and b/bin/com/interview/all/FindSalayLeassThan90000AndGropByDepartment.class differ diff --git a/bin/com/interview/all/FindSecondHighestSalary.class b/bin/com/interview/all/FindSecondHighestSalary.class new file mode 100644 index 0000000..c1987d7 Binary files /dev/null and b/bin/com/interview/all/FindSecondHighestSalary.class differ diff --git a/bin/com/globant/FindTheAverageOfListElements.class b/bin/com/interview/all/FindTheAverageOfListElements.class similarity index 89% rename from bin/com/globant/FindTheAverageOfListElements.class rename to bin/com/interview/all/FindTheAverageOfListElements.class index 337dfee..1563ee1 100644 Binary files a/bin/com/globant/FindTheAverageOfListElements.class and b/bin/com/interview/all/FindTheAverageOfListElements.class differ diff --git a/bin/com/interview/all/FindTop3DigitFromList.class b/bin/com/interview/all/FindTop3DigitFromList.class new file mode 100644 index 0000000..9e22b75 Binary files /dev/null and b/bin/com/interview/all/FindTop3DigitFromList.class differ diff --git a/bin/com/clairvoyant/FindValuesBetween10To20FromListUsingJava8.class b/bin/com/interview/all/FindValuesBetween10To20FromListUsingJava8.class similarity index 86% rename from bin/com/clairvoyant/FindValuesBetween10To20FromListUsingJava8.class rename to bin/com/interview/all/FindValuesBetween10To20FromListUsingJava8.class index b0dbf96..6baf9d0 100644 Binary files a/bin/com/clairvoyant/FindValuesBetween10To20FromListUsingJava8.class and b/bin/com/interview/all/FindValuesBetween10To20FromListUsingJava8.class differ diff --git a/bin/com/interview/all/FoodFactory.class b/bin/com/interview/all/FoodFactory.class new file mode 100644 index 0000000..5114b1c Binary files /dev/null and b/bin/com/interview/all/FoodFactory.class differ diff --git a/bin/com/interview/generic/GenericDualEelement.class b/bin/com/interview/all/GenericDualEelement.class similarity index 72% rename from bin/com/interview/generic/GenericDualEelement.class rename to bin/com/interview/all/GenericDualEelement.class index 97b39de..75d23a7 100644 Binary files a/bin/com/interview/generic/GenericDualEelement.class and b/bin/com/interview/all/GenericDualEelement.class differ diff --git a/bin/com/interview/generic/GenericMethods.class b/bin/com/interview/all/GenericMethods.class similarity index 85% rename from bin/com/interview/generic/GenericMethods.class rename to bin/com/interview/all/GenericMethods.class index 2f3bf93..07b6fc5 100644 Binary files a/bin/com/interview/generic/GenericMethods.class and b/bin/com/interview/all/GenericMethods.class differ diff --git a/bin/com/interview/generic/GenericSingleEelement.class b/bin/com/interview/all/GenericSingleEelement.class similarity index 52% rename from bin/com/interview/generic/GenericSingleEelement.class rename to bin/com/interview/all/GenericSingleEelement.class index d4ec52b..8a77b08 100644 Binary files a/bin/com/interview/generic/GenericSingleEelement.class and b/bin/com/interview/all/GenericSingleEelement.class differ diff --git a/bin/com/interview/all/GenericTest.class b/bin/com/interview/all/GenericTest.class new file mode 100644 index 0000000..fc907e3 Binary files /dev/null and b/bin/com/interview/all/GenericTest.class differ diff --git a/bin/com/interview/volkasvegon/GroupStudentByState.class b/bin/com/interview/all/GroupStudentByState.class similarity index 64% rename from bin/com/interview/volkasvegon/GroupStudentByState.class rename to bin/com/interview/all/GroupStudentByState.class index e03264f..98c55c2 100644 Binary files a/bin/com/interview/volkasvegon/GroupStudentByState.class and b/bin/com/interview/all/GroupStudentByState.class differ diff --git a/bin/com/interview/capgamini052024/HashMapIteration.class b/bin/com/interview/all/HashMapIteration.class similarity index 90% rename from bin/com/interview/capgamini052024/HashMapIteration.class rename to bin/com/interview/all/HashMapIteration.class index 5430ada..f574446 100644 Binary files a/bin/com/interview/capgamini052024/HashMapIteration.class and b/bin/com/interview/all/HashMapIteration.class differ diff --git a/bin/com/interview/all/ImmutablePersonClass.class b/bin/com/interview/all/ImmutablePersonClass.class new file mode 100644 index 0000000..ce8f9c6 Binary files /dev/null and b/bin/com/interview/all/ImmutablePersonClass.class differ diff --git a/bin/com/interview/ili/lilly/ImmutableStringCheck.class b/bin/com/interview/all/ImmutableStringCheck.class similarity index 64% rename from bin/com/interview/ili/lilly/ImmutableStringCheck.class rename to bin/com/interview/all/ImmutableStringCheck.class index 707c37a..ac8d295 100644 Binary files a/bin/com/interview/ili/lilly/ImmutableStringCheck.class and b/bin/com/interview/all/ImmutableStringCheck.class differ diff --git a/bin/com/interview/all/Italian.class b/bin/com/interview/all/Italian.class new file mode 100644 index 0000000..a418800 Binary files /dev/null and b/bin/com/interview/all/Italian.class differ diff --git a/bin/com/interview/all/Japanese.class b/bin/com/interview/all/Japanese.class new file mode 100644 index 0000000..517bd88 Binary files /dev/null and b/bin/com/interview/all/Japanese.class differ diff --git a/bin/com/interview/capgamini052024/LinkedListTest.class b/bin/com/interview/all/LinkedListTest.class similarity index 60% rename from bin/com/interview/capgamini052024/LinkedListTest.class rename to bin/com/interview/all/LinkedListTest.class index e0b0f7c..90a2415 100644 Binary files a/bin/com/interview/capgamini052024/LinkedListTest.class and b/bin/com/interview/all/LinkedListTest.class differ diff --git a/bin/com/interview/tsys/MainClass.class b/bin/com/interview/all/MainClass.class similarity index 92% rename from bin/com/interview/tsys/MainClass.class rename to bin/com/interview/all/MainClass.class index 98b0356..c62b073 100644 Binary files a/bin/com/interview/tsys/MainClass.class and b/bin/com/interview/all/MainClass.class differ diff --git a/bin/com/interview/all/MainMethodOverloadDemo.class b/bin/com/interview/all/MainMethodOverloadDemo.class new file mode 100644 index 0000000..3355be1 Binary files /dev/null and b/bin/com/interview/all/MainMethodOverloadDemo.class differ diff --git a/bin/com/interview/globlogic/MaxSumFromTwoLists.class b/bin/com/interview/all/MaxSumFromTwoLists.class similarity index 87% rename from bin/com/interview/globlogic/MaxSumFromTwoLists.class rename to bin/com/interview/all/MaxSumFromTwoLists.class index 25ab1c7..7cc439e 100644 Binary files a/bin/com/interview/globlogic/MaxSumFromTwoLists.class and b/bin/com/interview/all/MaxSumFromTwoLists.class differ diff --git a/bin/com/clairvoyant/MergeTwoArrayAndFindUniqueValue.class b/bin/com/interview/all/MergeTwoArrayAndFindUniqueValue.class similarity index 67% rename from bin/com/clairvoyant/MergeTwoArrayAndFindUniqueValue.class rename to bin/com/interview/all/MergeTwoArrayAndFindUniqueValue.class index c07dfdb..7cb598f 100644 Binary files a/bin/com/clairvoyant/MergeTwoArrayAndFindUniqueValue.class and b/bin/com/interview/all/MergeTwoArrayAndFindUniqueValue.class differ diff --git a/bin/com/clairvoyant/MergeTwoArrayFindUniqe.class b/bin/com/interview/all/MergeTwoArrayFindUniqe.class similarity index 89% rename from bin/com/clairvoyant/MergeTwoArrayFindUniqe.class rename to bin/com/interview/all/MergeTwoArrayFindUniqe.class index ea2e4af..89ab4cb 100644 Binary files a/bin/com/clairvoyant/MergeTwoArrayFindUniqe.class and b/bin/com/interview/all/MergeTwoArrayFindUniqe.class differ diff --git a/bin/com/interview/all/MergeTwoArrayJava8.class b/bin/com/interview/all/MergeTwoArrayJava8.class new file mode 100644 index 0000000..b6cef5a Binary files /dev/null and b/bin/com/interview/all/MergeTwoArrayJava8.class differ diff --git a/bin/com/interview/test/Test.class b/bin/com/interview/all/MethodOverloadTest.class similarity index 83% rename from bin/com/interview/test/Test.class rename to bin/com/interview/all/MethodOverloadTest.class index bc680ba..d6f345a 100644 Binary files a/bin/com/interview/test/Test.class and b/bin/com/interview/all/MethodOverloadTest.class differ diff --git a/bin/com/interview/all/Mexican.class b/bin/com/interview/all/Mexican.class new file mode 100644 index 0000000..8ab4521 Binary files /dev/null and b/bin/com/interview/all/Mexican.class differ diff --git a/bin/com/interview/hcl/MyClassA.class b/bin/com/interview/all/MyClassA.class similarity index 80% rename from bin/com/interview/hcl/MyClassA.class rename to bin/com/interview/all/MyClassA.class index d961c34..5d3ad62 100644 Binary files a/bin/com/interview/hcl/MyClassA.class and b/bin/com/interview/all/MyClassA.class differ diff --git a/bin/com/interview/hcl/MyClassB.class b/bin/com/interview/all/MyClassB.class similarity index 81% rename from bin/com/interview/hcl/MyClassB.class rename to bin/com/interview/all/MyClassB.class index 9ab479f..8037c4d 100644 Binary files a/bin/com/interview/hcl/MyClassB.class and b/bin/com/interview/all/MyClassB.class differ diff --git a/bin/com/interview/interview/NumSimilarStrings.class b/bin/com/interview/all/NumSimilarStrings.class similarity index 84% rename from bin/com/interview/interview/NumSimilarStrings.class rename to bin/com/interview/all/NumSimilarStrings.class index 413e80a..c9f25d4 100644 Binary files a/bin/com/interview/interview/NumSimilarStrings.class and b/bin/com/interview/all/NumSimilarStrings.class differ diff --git a/bin/com/accolite2025/OverrideDefaultMethod.class b/bin/com/interview/all/OverrideDefaultMethod.class similarity index 51% rename from bin/com/accolite2025/OverrideDefaultMethod.class rename to bin/com/interview/all/OverrideDefaultMethod.class index 5bbbe20..87d2dab 100644 Binary files a/bin/com/accolite2025/OverrideDefaultMethod.class and b/bin/com/interview/all/OverrideDefaultMethod.class differ diff --git a/bin/com/interview/all/OverridingChild.class b/bin/com/interview/all/OverridingChild.class new file mode 100644 index 0000000..0d75238 Binary files /dev/null and b/bin/com/interview/all/OverridingChild.class differ diff --git a/bin/com/interview/all/OverridingParent.class b/bin/com/interview/all/OverridingParent.class new file mode 100644 index 0000000..ef493aa Binary files /dev/null and b/bin/com/interview/all/OverridingParent.class differ diff --git a/bin/com/interview/all/Parent.class b/bin/com/interview/all/Parent.class new file mode 100644 index 0000000..9db44c8 Binary files /dev/null and b/bin/com/interview/all/Parent.class differ diff --git a/bin/com/interview/interview/Parent.class b/bin/com/interview/all/Parenti.class similarity index 54% rename from bin/com/interview/interview/Parent.class rename to bin/com/interview/all/Parenti.class index 1b77cb8..c78b9b7 100644 Binary files a/bin/com/interview/interview/Parent.class and b/bin/com/interview/all/Parenti.class differ diff --git a/bin/com/interview/all/Person.class b/bin/com/interview/all/Person.class new file mode 100644 index 0000000..27646f1 Binary files /dev/null and b/bin/com/interview/all/Person.class differ diff --git a/bin/com/interview/all/PrintDuplicateValuesFromSet.class b/bin/com/interview/all/PrintDuplicateValuesFromSet.class new file mode 100644 index 0000000..ea10a94 Binary files /dev/null and b/bin/com/interview/all/PrintDuplicateValuesFromSet.class differ diff --git a/bin/com/interview/all/RemoveDuplicateCharacterFromString.class b/bin/com/interview/all/RemoveDuplicateCharacterFromString.class new file mode 100644 index 0000000..a29d7f6 Binary files /dev/null and b/bin/com/interview/all/RemoveDuplicateCharacterFromString.class differ diff --git a/bin/com/interview/all/ReverseListByDescendingOrder.class b/bin/com/interview/all/ReverseListByDescendingOrder.class new file mode 100644 index 0000000..2efda91 Binary files /dev/null and b/bin/com/interview/all/ReverseListByDescendingOrder.class differ diff --git a/bin/com/interview/all/ReverseStringUsingJava8.class b/bin/com/interview/all/ReverseStringUsingJava8.class new file mode 100644 index 0000000..2aaf3d8 Binary files /dev/null and b/bin/com/interview/all/ReverseStringUsingJava8.class differ diff --git a/bin/com/interview/capgamini052024/RunnableInterface.class b/bin/com/interview/all/RunnableInterface.class similarity index 61% rename from bin/com/interview/capgamini052024/RunnableInterface.class rename to bin/com/interview/all/RunnableInterface.class index 2571312..f2ef27f 100644 Binary files a/bin/com/interview/capgamini052024/RunnableInterface.class and b/bin/com/interview/all/RunnableInterface.class differ diff --git a/bin/com/interview/hcl/SetTest.class b/bin/com/interview/all/SetTest.class similarity index 92% rename from bin/com/interview/hcl/SetTest.class rename to bin/com/interview/all/SetTest.class index 787b8fe..b604e3b 100644 Binary files a/bin/com/interview/hcl/SetTest.class and b/bin/com/interview/all/SetTest.class differ diff --git a/bin/com/interview/all/ShallowCopyPerson.class b/bin/com/interview/all/ShallowCopyPerson.class new file mode 100644 index 0000000..4bea99f Binary files /dev/null and b/bin/com/interview/all/ShallowCopyPerson.class differ diff --git a/bin/com/interview/all/ShortStringInAscendingOrder.class b/bin/com/interview/all/ShortStringInAscendingOrder.class new file mode 100644 index 0000000..5b47aae Binary files /dev/null and b/bin/com/interview/all/ShortStringInAscendingOrder.class differ diff --git a/bin/com/interview/capgamini052024/Singleton.class b/bin/com/interview/all/Singleton.class similarity index 81% rename from bin/com/interview/capgamini052024/Singleton.class rename to bin/com/interview/all/Singleton.class index f9ba96a..9ff43c3 100644 Binary files a/bin/com/interview/capgamini052024/Singleton.class and b/bin/com/interview/all/Singleton.class differ diff --git a/bin/com/interview/all/SingletonVolkasvagon.class b/bin/com/interview/all/SingletonVolkasvagon.class new file mode 100644 index 0000000..8149214 Binary files /dev/null and b/bin/com/interview/all/SingletonVolkasvagon.class differ diff --git a/bin/com/cuisine/Solution.class b/bin/com/interview/all/Solution.class similarity index 53% rename from bin/com/cuisine/Solution.class rename to bin/com/interview/all/Solution.class index 60cfcb1..46d65af 100644 Binary files a/bin/com/cuisine/Solution.class and b/bin/com/interview/all/Solution.class differ diff --git a/bin/com/interview/mphasis/SortArray.class b/bin/com/interview/all/SortArray.class similarity index 86% rename from bin/com/interview/mphasis/SortArray.class rename to bin/com/interview/all/SortArray.class index 7532485..50d1b75 100644 Binary files a/bin/com/interview/mphasis/SortArray.class and b/bin/com/interview/all/SortArray.class differ diff --git a/bin/com/interview/all/SortByEmpName.class b/bin/com/interview/all/SortByEmpName.class new file mode 100644 index 0000000..22b51fa Binary files /dev/null and b/bin/com/interview/all/SortByEmpName.class differ diff --git a/bin/com/interview/all/SortListOfAlphaNumericStringOnTheBasisOfNumber.class b/bin/com/interview/all/SortListOfAlphaNumericStringOnTheBasisOfNumber.class new file mode 100644 index 0000000..37f567b Binary files /dev/null and b/bin/com/interview/all/SortListOfAlphaNumericStringOnTheBasisOfNumber.class differ diff --git a/bin/com/interview/all/SortMapByValues.class b/bin/com/interview/all/SortMapByValues.class new file mode 100644 index 0000000..e35cdd0 Binary files /dev/null and b/bin/com/interview/all/SortMapByValues.class differ diff --git a/bin/com/interview/all/Sortbyname.class b/bin/com/interview/all/Sortbyname.class new file mode 100644 index 0000000..22307c3 Binary files /dev/null and b/bin/com/interview/all/Sortbyname.class differ diff --git a/bin/com/interview/all/Sortbyroll.class b/bin/com/interview/all/Sortbyroll.class new file mode 100644 index 0000000..ee8dbfe Binary files /dev/null and b/bin/com/interview/all/Sortbyroll.class differ diff --git a/bin/com/interview/all/StaticDemo.class b/bin/com/interview/all/StaticDemo.class new file mode 100644 index 0000000..8edc4fd Binary files /dev/null and b/bin/com/interview/all/StaticDemo.class differ diff --git a/bin/com/interview/interview/StringOperationsInJava.class b/bin/com/interview/all/StringOperationsInJava.class similarity index 87% rename from bin/com/interview/interview/StringOperationsInJava.class rename to bin/com/interview/all/StringOperationsInJava.class index 5bd6871..abeb0ec 100644 Binary files a/bin/com/interview/interview/StringOperationsInJava.class and b/bin/com/interview/all/StringOperationsInJava.class differ diff --git a/bin/com/interview/all/StringTest.class b/bin/com/interview/all/StringTest.class new file mode 100644 index 0000000..e70ac78 Binary files /dev/null and b/bin/com/interview/all/StringTest.class differ diff --git a/bin/com/interview/capgamini052024/Student.class b/bin/com/interview/all/Student.class similarity index 65% rename from bin/com/interview/capgamini052024/Student.class rename to bin/com/interview/all/Student.class index 9152bd9..225198c 100644 Binary files a/bin/com/interview/capgamini052024/Student.class and b/bin/com/interview/all/Student.class differ diff --git a/bin/com/interview/volkasvegon/Student.class b/bin/com/interview/all/StudentStateGroup.class similarity index 69% rename from bin/com/interview/volkasvegon/Student.class rename to bin/com/interview/all/StudentStateGroup.class index 4879eeb..b252c2a 100644 Binary files a/bin/com/interview/volkasvegon/Student.class and b/bin/com/interview/all/StudentStateGroup.class differ diff --git a/bin/com/interview/puresoftware/SumOfListEeveNumbers.class b/bin/com/interview/all/SumOfListEeveNumbers.class similarity index 89% rename from bin/com/interview/puresoftware/SumOfListEeveNumbers.class rename to bin/com/interview/all/SumOfListEeveNumbers.class index d6eb240..2d6c739 100644 Binary files a/bin/com/interview/puresoftware/SumOfListEeveNumbers.class and b/bin/com/interview/all/SumOfListEeveNumbers.class differ diff --git a/bin/com/interview/all/SumOfNestedList.class b/bin/com/interview/all/SumOfNestedList.class new file mode 100644 index 0000000..d5fc470 Binary files /dev/null and b/bin/com/interview/all/SumOfNestedList.class differ diff --git a/bin/com/interview/josh/SumOfThreeByThreeMatrix.class b/bin/com/interview/all/SumOfThreeByThreeMatrix.class similarity index 72% rename from bin/com/interview/josh/SumOfThreeByThreeMatrix.class rename to bin/com/interview/all/SumOfThreeByThreeMatrix.class index 1a178ba..6904837 100644 Binary files a/bin/com/interview/josh/SumOfThreeByThreeMatrix.class and b/bin/com/interview/all/SumOfThreeByThreeMatrix.class differ diff --git a/bin/com/interview/all/SumTwoIntegerTypeListElementAndFindMaxSumFromBoth.class b/bin/com/interview/all/SumTwoIntegerTypeListElementAndFindMaxSumFromBoth.class new file mode 100644 index 0000000..277241d Binary files /dev/null and b/bin/com/interview/all/SumTwoIntegerTypeListElementAndFindMaxSumFromBoth.class differ diff --git a/bin/com/interview/galaxe/Test.class b/bin/com/interview/all/Test.class similarity index 94% rename from bin/com/interview/galaxe/Test.class rename to bin/com/interview/all/Test.class index 6b0d92e..855b915 100644 Binary files a/bin/com/interview/galaxe/Test.class and b/bin/com/interview/all/Test.class differ diff --git a/bin/com/interview/crymsonlogic/Test2.class b/bin/com/interview/all/Test2crymsonlogic.class similarity index 64% rename from bin/com/interview/crymsonlogic/Test2.class rename to bin/com/interview/all/Test2crymsonlogic.class index cb9bc00..6c69aa9 100644 Binary files a/bin/com/interview/crymsonlogic/Test2.class and b/bin/com/interview/all/Test2crymsonlogic.class differ diff --git a/bin/com/interview/generic/TestArrayListGeneric.class b/bin/com/interview/all/TestArrayListGeneric.class similarity index 72% rename from bin/com/interview/generic/TestArrayListGeneric.class rename to bin/com/interview/all/TestArrayListGeneric.class index e0680a3..93f4742 100644 Binary files a/bin/com/interview/generic/TestArrayListGeneric.class and b/bin/com/interview/all/TestArrayListGeneric.class differ diff --git a/bin/com/interview/capgamini052024/Test.class b/bin/com/interview/all/TestCapgamini.class similarity index 81% rename from bin/com/interview/capgamini052024/Test.class rename to bin/com/interview/all/TestCapgamini.class index 4219349..d50799a 100644 Binary files a/bin/com/interview/capgamini052024/Test.class and b/bin/com/interview/all/TestCapgamini.class differ diff --git a/bin/com/interview/mphasis/Test.class b/bin/com/interview/all/TestMphasis.class similarity index 83% rename from bin/com/interview/mphasis/Test.class rename to bin/com/interview/all/TestMphasis.class index 3b66ede..285c8e5 100644 Binary files a/bin/com/interview/mphasis/Test.class and b/bin/com/interview/all/TestMphasis.class differ diff --git a/bin/com/nisum/Test.class b/bin/com/interview/all/TestNisum.class similarity index 93% rename from bin/com/nisum/Test.class rename to bin/com/interview/all/TestNisum.class index ff8cfb4..673a667 100644 Binary files a/bin/com/nisum/Test.class and b/bin/com/interview/all/TestNisum.class differ diff --git a/bin/com/interview/crymsonlogic/Test.class b/bin/com/interview/all/Testcrymsonlogic1.class similarity index 81% rename from bin/com/interview/crymsonlogic/Test.class rename to bin/com/interview/all/Testcrymsonlogic1.class index 2260e22..b619758 100644 Binary files a/bin/com/interview/crymsonlogic/Test.class and b/bin/com/interview/all/Testcrymsonlogic1.class differ diff --git a/bin/com/interview/all/TreeSetCustomObjectSort.class b/bin/com/interview/all/TreeSetCustomObjectSort.class new file mode 100644 index 0000000..4c472a9 Binary files /dev/null and b/bin/com/interview/all/TreeSetCustomObjectSort.class differ diff --git a/bin/com/interview/interview/TwoSum.class b/bin/com/interview/all/TwoSum.class similarity index 78% rename from bin/com/interview/interview/TwoSum.class rename to bin/com/interview/all/TwoSum.class index 2d6ad53..6a68020 100644 Binary files a/bin/com/interview/interview/TwoSum.class and b/bin/com/interview/all/TwoSum.class differ diff --git a/bin/com/interview/all/UnservableCuisineRequestException.class b/bin/com/interview/all/UnservableCuisineRequestException.class new file mode 100644 index 0000000..6fa2e9f Binary files /dev/null and b/bin/com/interview/all/UnservableCuisineRequestException.class differ diff --git a/bin/com/interview/test/VarArgExample.class b/bin/com/interview/all/VarArgExample.class similarity index 66% rename from bin/com/interview/test/VarArgExample.class rename to bin/com/interview/all/VarArgExample.class index bf25faf..7b786f8 100644 Binary files a/bin/com/interview/test/VarArgExample.class and b/bin/com/interview/all/VarArgExample.class differ diff --git a/bin/com/browser/search/SearchPoint.class b/bin/com/interview/all/WebBrowserSearchPoint.class similarity index 78% rename from bin/com/browser/search/SearchPoint.class rename to bin/com/interview/all/WebBrowserSearchPoint.class index e0c62f9..0fabcb0 100644 Binary files a/bin/com/browser/search/SearchPoint.class and b/bin/com/interview/all/WebBrowserSearchPoint.class differ diff --git a/bin/com/interview/all/defaultMethodInterface.class b/bin/com/interview/all/defaultMethodInterface.class new file mode 100644 index 0000000..bf9e9e4 Binary files /dev/null and b/bin/com/interview/all/defaultMethodInterface.class differ diff --git a/bin/com/interview/arrays/ArrayFrequency.class b/bin/com/interview/arrays/ArrayFrequency.class deleted file mode 100644 index eb21770..0000000 Binary files a/bin/com/interview/arrays/ArrayFrequency.class and /dev/null differ diff --git a/bin/com/interview/arrays/BubbleSort.class b/bin/com/interview/arrays/BubbleSort.class deleted file mode 100644 index 4128376..0000000 Binary files a/bin/com/interview/arrays/BubbleSort.class and /dev/null differ diff --git a/bin/com/interview/arrays/CountOccuranceElement.class b/bin/com/interview/arrays/CountOccuranceElement.class deleted file mode 100644 index 8855a74..0000000 Binary files a/bin/com/interview/arrays/CountOccuranceElement.class and /dev/null differ diff --git a/bin/com/interview/arrays/ReverseArray.class b/bin/com/interview/arrays/ReverseArray.class deleted file mode 100644 index 194949e..0000000 Binary files a/bin/com/interview/arrays/ReverseArray.class and /dev/null differ diff --git a/bin/com/interview/arrays/SecondLargestNumber.class b/bin/com/interview/arrays/SecondLargestNumber.class deleted file mode 100644 index d243696..0000000 Binary files a/bin/com/interview/arrays/SecondLargestNumber.class and /dev/null differ diff --git a/bin/com/interview/arrays/ShortArrayWithSingleforLoop.class b/bin/com/interview/arrays/ShortArrayWithSingleforLoop.class deleted file mode 100644 index 4692779..0000000 Binary files a/bin/com/interview/arrays/ShortArrayWithSingleforLoop.class and /dev/null differ diff --git a/bin/com/interview/basic/CountEachCharacterOccurance.class b/bin/com/interview/basic/CountEachCharacterOccurance.class new file mode 100644 index 0000000..cd4d498 Binary files /dev/null and b/bin/com/interview/basic/CountEachCharacterOccurance.class differ diff --git a/bin/com/interview/basic/FirstNoRepeatCharacter.class b/bin/com/interview/basic/FirstNoRepeatCharacter.class new file mode 100644 index 0000000..3a13a83 Binary files /dev/null and b/bin/com/interview/basic/FirstNoRepeatCharacter.class differ diff --git a/bin/com/interview/basic/LastNoRepeatCharacter.class b/bin/com/interview/basic/LastNoRepeatCharacter.class new file mode 100644 index 0000000..25a7a0f Binary files /dev/null and b/bin/com/interview/basic/LastNoRepeatCharacter.class differ diff --git a/bin/com/interview/basic/RemoveDuplicate.class b/bin/com/interview/basic/RemoveDuplicate.class new file mode 100644 index 0000000..2cc363c Binary files /dev/null and b/bin/com/interview/basic/RemoveDuplicate.class differ diff --git a/bin/com/interview/basic/ReverseString.class b/bin/com/interview/basic/ReverseString.class new file mode 100644 index 0000000..b3ae189 Binary files /dev/null and b/bin/com/interview/basic/ReverseString.class differ diff --git a/bin/com/interview/capgamini052024/SortByEmpName.class b/bin/com/interview/capgamini052024/SortByEmpName.class deleted file mode 100644 index 26caa67..0000000 Binary files a/bin/com/interview/capgamini052024/SortByEmpName.class and /dev/null differ diff --git a/bin/com/interview/capgamini052024/Sortbyname.class b/bin/com/interview/capgamini052024/Sortbyname.class deleted file mode 100644 index fc4065c..0000000 Binary files a/bin/com/interview/capgamini052024/Sortbyname.class and /dev/null differ diff --git a/bin/com/interview/capgamini052024/Sortbyroll.class b/bin/com/interview/capgamini052024/Sortbyroll.class deleted file mode 100644 index f3f0b99..0000000 Binary files a/bin/com/interview/capgamini052024/Sortbyroll.class and /dev/null differ diff --git a/bin/com/interview/collection/list/SetIteration.class b/bin/com/interview/collection/list/SetIteration.class index 99425c0..6ed8a25 100644 Binary files a/bin/com/interview/collection/list/SetIteration.class and b/bin/com/interview/collection/list/SetIteration.class differ diff --git a/bin/com/interview/collection/list/VectorExample.class b/bin/com/interview/collection/list/VectorExample.class index 09a8838..a79908e 100644 Binary files a/bin/com/interview/collection/list/VectorExample.class and b/bin/com/interview/collection/list/VectorExample.class differ diff --git a/bin/com/interview/collectors/CollectorsExample.class b/bin/com/interview/collectors/CollectorsExample.class deleted file mode 100644 index 049e848..0000000 Binary files a/bin/com/interview/collectors/CollectorsExample.class and /dev/null differ diff --git a/bin/com/interview/collectors/Product.class b/bin/com/interview/collectors/Product.class deleted file mode 100644 index 596c537..0000000 Binary files a/bin/com/interview/collectors/Product.class and /dev/null differ diff --git a/bin/com/interview/data/structre/LinkedLists$Node.class b/bin/com/interview/data/structre/LinkedLists$Node.class deleted file mode 100644 index 01860bb..0000000 Binary files a/bin/com/interview/data/structre/LinkedLists$Node.class and /dev/null differ diff --git a/bin/com/interview/data/structre/LinkedLists.class b/bin/com/interview/data/structre/LinkedLists.class deleted file mode 100644 index a5e29f3..0000000 Binary files a/bin/com/interview/data/structre/LinkedLists.class and /dev/null differ diff --git a/bin/com/interview/data/structre/StackExample.class b/bin/com/interview/data/structre/StackExample.class deleted file mode 100644 index 2c87304..0000000 Binary files a/bin/com/interview/data/structre/StackExample.class and /dev/null differ diff --git a/bin/com/interview/datastructure/SortingArray.class b/bin/com/interview/datastructure/SortingArray.class index 52541aa..a186d28 100644 Binary files a/bin/com/interview/datastructure/SortingArray.class and b/bin/com/interview/datastructure/SortingArray.class differ diff --git a/bin/com/interview/galaxe/SortMapByValues.class b/bin/com/interview/galaxe/SortMapByValues.class deleted file mode 100644 index 57cf1e0..0000000 Binary files a/bin/com/interview/galaxe/SortMapByValues.class and /dev/null differ diff --git a/bin/com/interview/garbage/collector/JavafinalizeExample.class b/bin/com/interview/garbage/collector/JavafinalizeExample.class index 4320754..4f628d9 100644 Binary files a/bin/com/interview/garbage/collector/JavafinalizeExample.class and b/bin/com/interview/garbage/collector/JavafinalizeExample.class differ diff --git a/bin/com/interview/garbage/collector/TestGarbageCollector.class b/bin/com/interview/garbage/collector/TestGarbageCollector.class index cc17648..0557ffc 100644 Binary files a/bin/com/interview/garbage/collector/TestGarbageCollector.class and b/bin/com/interview/garbage/collector/TestGarbageCollector.class differ diff --git a/bin/com/interview/generic/GenericTest.class b/bin/com/interview/generic/GenericTest.class deleted file mode 100644 index f05d8d7..0000000 Binary files a/bin/com/interview/generic/GenericTest.class and /dev/null differ diff --git a/bin/com/interview/globlogic/SumTwoIntegerTypeListElementAndFindMaxSumFromBoth.class b/bin/com/interview/globlogic/SumTwoIntegerTypeListElementAndFindMaxSumFromBoth.class deleted file mode 100644 index cf3e103..0000000 Binary files a/bin/com/interview/globlogic/SumTwoIntegerTypeListElementAndFindMaxSumFromBoth.class and /dev/null differ diff --git a/bin/com/interview/hashmap/Account.class b/bin/com/interview/hashmap/Account.class index ba485e7..3ad36c3 100644 Binary files a/bin/com/interview/hashmap/Account.class and b/bin/com/interview/hashmap/Account.class differ diff --git a/bin/com/interview/hashmap/AccountAsKeyDemo.class b/bin/com/interview/hashmap/AccountAsKeyDemo.class index bd87ade..da58f03 100644 Binary files a/bin/com/interview/hashmap/AccountAsKeyDemo.class and b/bin/com/interview/hashmap/AccountAsKeyDemo.class differ diff --git a/bin/com/interview/hashmap/BankAccount.class b/bin/com/interview/hashmap/BankAccount.class index d2a8f11..efbc6c1 100644 Binary files a/bin/com/interview/hashmap/BankAccount.class and b/bin/com/interview/hashmap/BankAccount.class differ diff --git a/bin/com/interview/hashmap/Key.class b/bin/com/interview/hashmap/Key.class index efb90c9..3e7a0c3 100644 Binary files a/bin/com/interview/hashmap/Key.class and b/bin/com/interview/hashmap/Key.class differ diff --git a/bin/com/interview/hashmap/RemoveDuplicateObjectsUsingJavaEight.class b/bin/com/interview/hashmap/RemoveDuplicateObjectsUsingJavaEight.class index ad7e9cb..30d823a 100644 Binary files a/bin/com/interview/hashmap/RemoveDuplicateObjectsUsingJavaEight.class and b/bin/com/interview/hashmap/RemoveDuplicateObjectsUsingJavaEight.class differ diff --git a/bin/com/interview/hashmap/SortHashMapByValue.class b/bin/com/interview/hashmap/SortHashMapByValue.class index fd361c4..8222127 100644 Binary files a/bin/com/interview/hashmap/SortHashMapByValue.class and b/bin/com/interview/hashmap/SortHashMapByValue.class differ diff --git a/bin/com/interview/hashmap/WeakHashMapEx.class b/bin/com/interview/hashmap/WeakHashMapEx.class index 24dc91a..50ab768 100644 Binary files a/bin/com/interview/hashmap/WeakHashMapEx.class and b/bin/com/interview/hashmap/WeakHashMapEx.class differ diff --git a/bin/com/interview/hashmap/WeakHashMapExample.class b/bin/com/interview/hashmap/WeakHashMapExample.class index 12546a0..d7ecdcb 100644 Binary files a/bin/com/interview/hashmap/WeakHashMapExample.class and b/bin/com/interview/hashmap/WeakHashMapExample.class differ diff --git a/bin/com/interview/interview/ArrayOpearations.class b/bin/com/interview/interview/ArrayOpearations.class deleted file mode 100644 index 3d06b18..0000000 Binary files a/bin/com/interview/interview/ArrayOpearations.class and /dev/null differ diff --git a/bin/com/interview/interview/StaticDemo.class b/bin/com/interview/interview/StaticDemo.class deleted file mode 100644 index 62461ad..0000000 Binary files a/bin/com/interview/interview/StaticDemo.class and /dev/null differ diff --git a/bin/com/interview/java/eight/MethodReference.class b/bin/com/interview/java/eight/MethodReference.class deleted file mode 100644 index 7c26275..0000000 Binary files a/bin/com/interview/java/eight/MethodReference.class and /dev/null differ diff --git a/bin/com/interview/java8/AllStreams.class b/bin/com/interview/java8/AllStreams.class new file mode 100644 index 0000000..3ad6e50 Binary files /dev/null and b/bin/com/interview/java8/AllStreams.class differ diff --git a/bin/com/interview/java8/AnonymousFuntionExa.class b/bin/com/interview/java8/AnonymousFuntionExa.class index 40b8a6b..5144b36 100644 Binary files a/bin/com/interview/java8/AnonymousFuntionExa.class and b/bin/com/interview/java8/AnonymousFuntionExa.class differ diff --git a/bin/com/interview/java8/Calculater.class b/bin/com/interview/java8/Calculater.class index 86938db..bf167e8 100644 Binary files a/bin/com/interview/java8/Calculater.class and b/bin/com/interview/java8/Calculater.class differ diff --git a/bin/com/interview/java8/Customer.class b/bin/com/interview/java8/Customer.class new file mode 100644 index 0000000..c9afa94 Binary files /dev/null and b/bin/com/interview/java8/Customer.class differ diff --git a/bin/com/interview/java8/Employee.class b/bin/com/interview/java8/Employee.class new file mode 100644 index 0000000..656d698 Binary files /dev/null and b/bin/com/interview/java8/Employee.class differ diff --git a/bin/com/interview/java8/EmployeeEight.class b/bin/com/interview/java8/EmployeeEight.class index d377840..79b7195 100644 Binary files a/bin/com/interview/java8/EmployeeEight.class and b/bin/com/interview/java8/EmployeeEight.class differ diff --git a/bin/com/interview/java8/GreetingService.class b/bin/com/interview/java8/GreetingService.class index abae34f..33ab89c 100644 Binary files a/bin/com/interview/java8/GreetingService.class and b/bin/com/interview/java8/GreetingService.class differ diff --git a/bin/com/interview/java8/LambdaExamples.class b/bin/com/interview/java8/LambdaExamples.class index 48f7a11..5200bdb 100644 Binary files a/bin/com/interview/java8/LambdaExamples.class and b/bin/com/interview/java8/LambdaExamples.class differ diff --git a/bin/com/interview/java8/LamdaFunctionImpl.class b/bin/com/interview/java8/LamdaFunctionImpl.class index 2a0cfce..0aa449c 100644 Binary files a/bin/com/interview/java8/LamdaFunctionImpl.class and b/bin/com/interview/java8/LamdaFunctionImpl.class differ diff --git a/bin/com/interview/java8/MyFunctionalInterface.class b/bin/com/interview/java8/MyFunctionalInterface.class index cd8a048..b858a11 100644 Binary files a/bin/com/interview/java8/MyFunctionalInterface.class and b/bin/com/interview/java8/MyFunctionalInterface.class differ diff --git a/bin/com/interview/java8/ZeroParameter.class b/bin/com/interview/java8/ZeroParameter.class index 3053579..d51a31a 100644 Binary files a/bin/com/interview/java8/ZeroParameter.class and b/bin/com/interview/java8/ZeroParameter.class differ diff --git a/bin/com/interview/java8/classes/CollectorsClassExample.class b/bin/com/interview/java8/classes/CollectorsClassExample.class index 15879c7..52c115e 100644 Binary files a/bin/com/interview/java8/classes/CollectorsClassExample.class and b/bin/com/interview/java8/classes/CollectorsClassExample.class differ diff --git a/bin/com/interview/java8/classes/ForEachMethodExample.class b/bin/com/interview/java8/classes/ForEachMethodExample.class index d054231..9d0d39d 100644 Binary files a/bin/com/interview/java8/classes/ForEachMethodExample.class and b/bin/com/interview/java8/classes/ForEachMethodExample.class differ diff --git a/bin/com/interview/java8/classes/OptionalClassExamples.class b/bin/com/interview/java8/classes/OptionalClassExamples.class index ecb0736..ec8b5b5 100644 Binary files a/bin/com/interview/java8/classes/OptionalClassExamples.class and b/bin/com/interview/java8/classes/OptionalClassExamples.class differ diff --git a/bin/com/interview/java8/classes/StringJoinerClassExample.class b/bin/com/interview/java8/classes/StringJoinerClassExample.class index 9223788..cab5b32 100644 Binary files a/bin/com/interview/java8/classes/StringJoinerClassExample.class and b/bin/com/interview/java8/classes/StringJoinerClassExample.class differ diff --git a/bin/com/interview/java8/datetime/CompareTwoDatesInJava8.class b/bin/com/interview/java8/datetime/CompareTwoDatesInJava8.class index 0de9562..c969ed1 100644 Binary files a/bin/com/interview/java8/datetime/CompareTwoDatesInJava8.class and b/bin/com/interview/java8/datetime/CompareTwoDatesInJava8.class differ diff --git a/bin/com/interview/java8/datetime/ConvertStringToLocalDate.class b/bin/com/interview/java8/datetime/ConvertStringToLocalDate.class index af16de9..35d7b3f 100644 Binary files a/bin/com/interview/java8/datetime/ConvertStringToLocalDate.class and b/bin/com/interview/java8/datetime/ConvertStringToLocalDate.class differ diff --git a/bin/com/interview/java8/datetime/DateTimeDemo.class b/bin/com/interview/java8/datetime/DateTimeDemo.class index 6b8d18b..996bb8d 100644 Binary files a/bin/com/interview/java8/datetime/DateTimeDemo.class and b/bin/com/interview/java8/datetime/DateTimeDemo.class differ diff --git a/bin/com/interview/java8/datetime/FlightZoneDateTimeExample.class b/bin/com/interview/java8/datetime/FlightZoneDateTimeExample.class index 0e6bb82..24f135f 100644 Binary files a/bin/com/interview/java8/datetime/FlightZoneDateTimeExample.class and b/bin/com/interview/java8/datetime/FlightZoneDateTimeExample.class differ diff --git a/bin/com/interview/java8/datetime/Java8DateUtility.class b/bin/com/interview/java8/datetime/Java8DateUtility.class index 1f1d2f8..478d4ef 100644 Binary files a/bin/com/interview/java8/datetime/Java8DateUtility.class and b/bin/com/interview/java8/datetime/Java8DateUtility.class differ diff --git a/bin/com/interview/java8/datetime/LocalDateFormat.class b/bin/com/interview/java8/datetime/LocalDateFormat.class index 9bb420a..c18eb65 100644 Binary files a/bin/com/interview/java8/datetime/LocalDateFormat.class and b/bin/com/interview/java8/datetime/LocalDateFormat.class differ diff --git a/bin/com/interview/java8/datetime/LocalDateTimeFormat.class b/bin/com/interview/java8/datetime/LocalDateTimeFormat.class index df94c94..e785c5b 100644 Binary files a/bin/com/interview/java8/datetime/LocalDateTimeFormat.class and b/bin/com/interview/java8/datetime/LocalDateTimeFormat.class differ diff --git a/bin/com/interview/java8/datetime/TimeZoneId.class b/bin/com/interview/java8/datetime/TimeZoneId.class index 5732ef2..8c54363 100644 Binary files a/bin/com/interview/java8/datetime/TimeZoneId.class and b/bin/com/interview/java8/datetime/TimeZoneId.class differ diff --git a/bin/com/interview/java8/datetime/UseDuration.class b/bin/com/interview/java8/datetime/UseDuration.class index 6e08d37..2211a9e 100644 Binary files a/bin/com/interview/java8/datetime/UseDuration.class and b/bin/com/interview/java8/datetime/UseDuration.class differ diff --git a/bin/com/interview/java8/datetime/UseLocalDate.class b/bin/com/interview/java8/datetime/UseLocalDate.class index bc56617..5abfef8 100644 Binary files a/bin/com/interview/java8/datetime/UseLocalDate.class and b/bin/com/interview/java8/datetime/UseLocalDate.class differ diff --git a/bin/com/interview/java8/datetime/UseLocalDateTime.class b/bin/com/interview/java8/datetime/UseLocalDateTime.class index 0446cf1..218d9fb 100644 Binary files a/bin/com/interview/java8/datetime/UseLocalDateTime.class and b/bin/com/interview/java8/datetime/UseLocalDateTime.class differ diff --git a/bin/com/interview/java8/datetime/UseLocalTime.class b/bin/com/interview/java8/datetime/UseLocalTime.class index 3b7d403..ade2b82 100644 Binary files a/bin/com/interview/java8/datetime/UseLocalTime.class and b/bin/com/interview/java8/datetime/UseLocalTime.class differ diff --git a/bin/com/interview/java8/datetime/UsePeriod.class b/bin/com/interview/java8/datetime/UsePeriod.class index 4a6a708..e95ec4f 100644 Binary files a/bin/com/interview/java8/datetime/UsePeriod.class and b/bin/com/interview/java8/datetime/UsePeriod.class differ diff --git a/bin/com/interview/java8/datetime/UseToInstant.class b/bin/com/interview/java8/datetime/UseToInstant.class index 956dca0..38f9422 100644 Binary files a/bin/com/interview/java8/datetime/UseToInstant.class and b/bin/com/interview/java8/datetime/UseToInstant.class differ diff --git a/bin/com/interview/java8/datetime/UseZonedDateTime.class b/bin/com/interview/java8/datetime/UseZonedDateTime.class index c5b87c6..6137179 100644 Binary files a/bin/com/interview/java8/datetime/UseZonedDateTime.class and b/bin/com/interview/java8/datetime/UseZonedDateTime.class differ diff --git a/bin/com/interview/java8/defaultstaticinterfacemethods/DefaultInterface.class b/bin/com/interview/java8/defaultstaticinterfacemethods/DefaultInterface.class index ca92951..ec48026 100644 Binary files a/bin/com/interview/java8/defaultstaticinterfacemethods/DefaultInterface.class and b/bin/com/interview/java8/defaultstaticinterfacemethods/DefaultInterface.class differ diff --git a/bin/com/interview/java8/defaultstaticinterfacemethods/TestJava8Interface.class b/bin/com/interview/java8/defaultstaticinterfacemethods/TestJava8Interface.class index 03c5a5d..0bea291 100644 Binary files a/bin/com/interview/java8/defaultstaticinterfacemethods/TestJava8Interface.class and b/bin/com/interview/java8/defaultstaticinterfacemethods/TestJava8Interface.class differ diff --git a/bin/com/interview/java8/defaultstaticinterfacemethods/impl/Car.class b/bin/com/interview/java8/defaultstaticinterfacemethods/impl/Car.class index b336ea5..bfac5a2 100644 Binary files a/bin/com/interview/java8/defaultstaticinterfacemethods/impl/Car.class and b/bin/com/interview/java8/defaultstaticinterfacemethods/impl/Car.class differ diff --git a/bin/com/interview/java8/defaultstaticinterfacemethods/impl/Motorbike.class b/bin/com/interview/java8/defaultstaticinterfacemethods/impl/Motorbike.class index e903a3f..8728c41 100644 Binary files a/bin/com/interview/java8/defaultstaticinterfacemethods/impl/Motorbike.class and b/bin/com/interview/java8/defaultstaticinterfacemethods/impl/Motorbike.class differ diff --git a/bin/com/interview/java8/defaultstaticinterfacemethods/impl/MultiAlarmCar.class b/bin/com/interview/java8/defaultstaticinterfacemethods/impl/MultiAlarmCar.class index 49c31b7..1ca9474 100644 Binary files a/bin/com/interview/java8/defaultstaticinterfacemethods/impl/MultiAlarmCar.class and b/bin/com/interview/java8/defaultstaticinterfacemethods/impl/MultiAlarmCar.class differ diff --git a/bin/com/interview/java8/defaultstaticinterfacemethods/interfaces/Alarm.class b/bin/com/interview/java8/defaultstaticinterfacemethods/interfaces/Alarm.class index ae2724d..9d71d7a 100644 Binary files a/bin/com/interview/java8/defaultstaticinterfacemethods/interfaces/Alarm.class and b/bin/com/interview/java8/defaultstaticinterfacemethods/interfaces/Alarm.class differ diff --git a/bin/com/interview/java8/defaultstaticinterfacemethods/interfaces/Vehicle.class b/bin/com/interview/java8/defaultstaticinterfacemethods/interfaces/Vehicle.class index c69af62..569e64c 100644 Binary files a/bin/com/interview/java8/defaultstaticinterfacemethods/interfaces/Vehicle.class and b/bin/com/interview/java8/defaultstaticinterfacemethods/interfaces/Vehicle.class differ diff --git a/bin/com/interview/java8/functionalInterfaces/BiConsumersExample.class b/bin/com/interview/java8/functionalInterfaces/BiConsumersExample.class index aea20ec..8efbf93 100644 Binary files a/bin/com/interview/java8/functionalInterfaces/BiConsumersExample.class and b/bin/com/interview/java8/functionalInterfaces/BiConsumersExample.class differ diff --git a/bin/com/interview/java8/functionalInterfaces/BiFunctionExample.class b/bin/com/interview/java8/functionalInterfaces/BiFunctionExample.class index 7ac5250..bd44172 100644 Binary files a/bin/com/interview/java8/functionalInterfaces/BiFunctionExample.class and b/bin/com/interview/java8/functionalInterfaces/BiFunctionExample.class differ diff --git a/bin/com/interview/java8/functionalInterfaces/ConsumersExample.class b/bin/com/interview/java8/functionalInterfaces/ConsumersExample.class index 4f1e1f5..218f670 100644 Binary files a/bin/com/interview/java8/functionalInterfaces/ConsumersExample.class and b/bin/com/interview/java8/functionalInterfaces/ConsumersExample.class differ diff --git a/bin/com/interview/java8/functionalInterfaces/FunctionExample.class b/bin/com/interview/java8/functionalInterfaces/FunctionExample.class index d4d0e6e..acf2026 100644 Binary files a/bin/com/interview/java8/functionalInterfaces/FunctionExample.class and b/bin/com/interview/java8/functionalInterfaces/FunctionExample.class differ diff --git a/bin/com/interview/java8/functionalInterfaces/FunctionalInterfacesExample.class b/bin/com/interview/java8/functionalInterfaces/FunctionalInterfacesExample.class index 67ce5c0..dd1162a 100644 Binary files a/bin/com/interview/java8/functionalInterfaces/FunctionalInterfacesExample.class and b/bin/com/interview/java8/functionalInterfaces/FunctionalInterfacesExample.class differ diff --git a/bin/com/interview/java8/functionalInterfaces/Person.class b/bin/com/interview/java8/functionalInterfaces/Person.class index d93c027..2f7fe20 100644 Binary files a/bin/com/interview/java8/functionalInterfaces/Person.class and b/bin/com/interview/java8/functionalInterfaces/Person.class differ diff --git a/bin/com/interview/java8/functionalInterfaces/PersonDTO.class b/bin/com/interview/java8/functionalInterfaces/PersonDTO.class index dc6f773..b9e93ba 100644 Binary files a/bin/com/interview/java8/functionalInterfaces/PersonDTO.class and b/bin/com/interview/java8/functionalInterfaces/PersonDTO.class differ diff --git a/bin/com/interview/java8/functionalInterfaces/PersonEntity.class b/bin/com/interview/java8/functionalInterfaces/PersonEntity.class index ac42eb0..749440b 100644 Binary files a/bin/com/interview/java8/functionalInterfaces/PersonEntity.class and b/bin/com/interview/java8/functionalInterfaces/PersonEntity.class differ diff --git a/bin/com/interview/java8/functionalInterfaces/PredicateExample.class b/bin/com/interview/java8/functionalInterfaces/PredicateExample.class index 51bd20f..4f8a521 100644 Binary files a/bin/com/interview/java8/functionalInterfaces/PredicateExample.class and b/bin/com/interview/java8/functionalInterfaces/PredicateExample.class differ diff --git a/bin/com/interview/java8/functionalInterfaces/Sayable.class b/bin/com/interview/java8/functionalInterfaces/Sayable.class index 0dc1e15..7c52774 100644 Binary files a/bin/com/interview/java8/functionalInterfaces/Sayable.class and b/bin/com/interview/java8/functionalInterfaces/Sayable.class differ diff --git a/bin/com/interview/java8/functionalInterfaces/SuppliersExample.class b/bin/com/interview/java8/functionalInterfaces/SuppliersExample.class index 1c69779..94c7c48 100644 Binary files a/bin/com/interview/java8/functionalInterfaces/SuppliersExample.class and b/bin/com/interview/java8/functionalInterfaces/SuppliersExample.class differ diff --git a/bin/com/interview/java8/lambda/Addable.class b/bin/com/interview/java8/lambda/Addable.class index 9d41d79..0b26158 100644 Binary files a/bin/com/interview/java8/lambda/Addable.class and b/bin/com/interview/java8/lambda/Addable.class differ diff --git a/bin/com/interview/java8/lambda/Arithmatic.class b/bin/com/interview/java8/lambda/Arithmatic.class index 927d618..4f18d97 100644 Binary files a/bin/com/interview/java8/lambda/Arithmatic.class and b/bin/com/interview/java8/lambda/Arithmatic.class differ diff --git a/bin/com/interview/java8/lambda/Drawable.class b/bin/com/interview/java8/lambda/Drawable.class index 91edcf2..a906f32 100644 Binary files a/bin/com/interview/java8/lambda/Drawable.class and b/bin/com/interview/java8/lambda/Drawable.class differ diff --git a/bin/com/interview/java8/lambda/IAvarage.class b/bin/com/interview/java8/lambda/IAvarage.class index c8e0dff..3cde320 100644 Binary files a/bin/com/interview/java8/lambda/IAvarage.class and b/bin/com/interview/java8/lambda/IAvarage.class differ diff --git a/bin/com/interview/java8/lambda/JLEComparatorExample$1.class b/bin/com/interview/java8/lambda/JLEComparatorExample$1.class index a916063..b18e777 100644 Binary files a/bin/com/interview/java8/lambda/JLEComparatorExample$1.class and b/bin/com/interview/java8/lambda/JLEComparatorExample$1.class differ diff --git a/bin/com/interview/java8/lambda/JLEComparatorExample.class b/bin/com/interview/java8/lambda/JLEComparatorExample.class index e554c7d..34fd3ae 100644 Binary files a/bin/com/interview/java8/lambda/JLEComparatorExample.class and b/bin/com/interview/java8/lambda/JLEComparatorExample.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleMultipleParameters$1.class b/bin/com/interview/java8/lambda/JLEExampleMultipleParameters$1.class index 6dfafd5..75260ae 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleMultipleParameters$1.class and b/bin/com/interview/java8/lambda/JLEExampleMultipleParameters$1.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleMultipleParameters.class b/bin/com/interview/java8/lambda/JLEExampleMultipleParameters.class index 3ce1c9f..ea10d52 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleMultipleParameters.class and b/bin/com/interview/java8/lambda/JLEExampleMultipleParameters.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleMultipleStatements$1.class b/bin/com/interview/java8/lambda/JLEExampleMultipleStatements$1.class index d687b57..247df32 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleMultipleStatements$1.class and b/bin/com/interview/java8/lambda/JLEExampleMultipleStatements$1.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleMultipleStatements.class b/bin/com/interview/java8/lambda/JLEExampleMultipleStatements.class index e324285..39498e0 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleMultipleStatements.class and b/bin/com/interview/java8/lambda/JLEExampleMultipleStatements.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleNoParameter$1.class b/bin/com/interview/java8/lambda/JLEExampleNoParameter$1.class index 32867f8..d6ddd4e 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleNoParameter$1.class and b/bin/com/interview/java8/lambda/JLEExampleNoParameter$1.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleNoParameter.class b/bin/com/interview/java8/lambda/JLEExampleNoParameter.class index c418576..4f98673 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleNoParameter.class and b/bin/com/interview/java8/lambda/JLEExampleNoParameter.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleRunnable$1.class b/bin/com/interview/java8/lambda/JLEExampleRunnable$1.class index 4ced1aa..d8ff67e 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleRunnable$1.class and b/bin/com/interview/java8/lambda/JLEExampleRunnable$1.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleRunnable.class b/bin/com/interview/java8/lambda/JLEExampleRunnable.class index 5936d24..36a33bd 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleRunnable.class and b/bin/com/interview/java8/lambda/JLEExampleRunnable.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleSingleParameter$1.class b/bin/com/interview/java8/lambda/JLEExampleSingleParameter$1.class index f6f16cd..362048a 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleSingleParameter$1.class and b/bin/com/interview/java8/lambda/JLEExampleSingleParameter$1.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleSingleParameter.class b/bin/com/interview/java8/lambda/JLEExampleSingleParameter.class index 5af88dc..7f1d9ca 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleSingleParameter.class and b/bin/com/interview/java8/lambda/JLEExampleSingleParameter.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleWithORWithOutReturnKeyword$1.class b/bin/com/interview/java8/lambda/JLEExampleWithORWithOutReturnKeyword$1.class index bef11a3..2289223 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleWithORWithOutReturnKeyword$1.class and b/bin/com/interview/java8/lambda/JLEExampleWithORWithOutReturnKeyword$1.class differ diff --git a/bin/com/interview/java8/lambda/JLEExampleWithORWithOutReturnKeyword.class b/bin/com/interview/java8/lambda/JLEExampleWithORWithOutReturnKeyword.class index d43643f..35ff27e 100644 Binary files a/bin/com/interview/java8/lambda/JLEExampleWithORWithOutReturnKeyword.class and b/bin/com/interview/java8/lambda/JLEExampleWithORWithOutReturnKeyword.class differ diff --git a/bin/com/interview/java8/lambda/LambdaEventListenerExample.class b/bin/com/interview/java8/lambda/LambdaEventListenerExample.class index 2523f0e..3f940a2 100644 Binary files a/bin/com/interview/java8/lambda/LambdaEventListenerExample.class and b/bin/com/interview/java8/lambda/LambdaEventListenerExample.class differ diff --git a/bin/com/interview/java8/lambda/LambdaExpressionExample$1.class b/bin/com/interview/java8/lambda/LambdaExpressionExample$1.class index fa96e0f..1253c02 100644 Binary files a/bin/com/interview/java8/lambda/LambdaExpressionExample$1.class and b/bin/com/interview/java8/lambda/LambdaExpressionExample$1.class differ diff --git a/bin/com/interview/java8/lambda/LambdaExpressionExample.class b/bin/com/interview/java8/lambda/LambdaExpressionExample.class index 35dd630..e74ed92 100644 Binary files a/bin/com/interview/java8/lambda/LambdaExpressionExample.class and b/bin/com/interview/java8/lambda/LambdaExpressionExample.class differ diff --git a/bin/com/interview/java8/lambda/Person.class b/bin/com/interview/java8/lambda/Person.class index d0736db..960c65b 100644 Binary files a/bin/com/interview/java8/lambda/Person.class and b/bin/com/interview/java8/lambda/Person.class differ diff --git a/bin/com/interview/java8/lambda/Printable.class b/bin/com/interview/java8/lambda/Printable.class index bdffc25..f1d2b54 100644 Binary files a/bin/com/interview/java8/lambda/Printable.class and b/bin/com/interview/java8/lambda/Printable.class differ diff --git a/bin/com/interview/java8/lambda/Sayable.class b/bin/com/interview/java8/lambda/Sayable.class index 47984eb..16e97cd 100644 Binary files a/bin/com/interview/java8/lambda/Sayable.class and b/bin/com/interview/java8/lambda/Sayable.class differ diff --git a/bin/com/interview/java8/methodreferences/Arithmetic.class b/bin/com/interview/java8/methodreferences/Arithmetic.class index 33da94f..f9244b9 100644 Binary files a/bin/com/interview/java8/methodreferences/Arithmetic.class and b/bin/com/interview/java8/methodreferences/Arithmetic.class differ diff --git a/bin/com/interview/java8/methodreferences/Message.class b/bin/com/interview/java8/methodreferences/Message.class index 361e731..318218a 100644 Binary files a/bin/com/interview/java8/methodreferences/Message.class and b/bin/com/interview/java8/methodreferences/Message.class differ diff --git a/bin/com/interview/java8/methodreferences/Messageable.class b/bin/com/interview/java8/methodreferences/Messageable.class index 5d8b92a..f7b43f3 100644 Binary files a/bin/com/interview/java8/methodreferences/Messageable.class and b/bin/com/interview/java8/methodreferences/Messageable.class differ diff --git a/bin/com/interview/java8/methodreferences/ReferenceToConstructor.class b/bin/com/interview/java8/methodreferences/ReferenceToConstructor.class index dac03cc..8c35b2c 100644 Binary files a/bin/com/interview/java8/methodreferences/ReferenceToConstructor.class and b/bin/com/interview/java8/methodreferences/ReferenceToConstructor.class differ diff --git a/bin/com/interview/java8/methodreferences/ReferenceToInstanceMethod.class b/bin/com/interview/java8/methodreferences/ReferenceToInstanceMethod.class index 743cf37..32404a1 100644 Binary files a/bin/com/interview/java8/methodreferences/ReferenceToInstanceMethod.class and b/bin/com/interview/java8/methodreferences/ReferenceToInstanceMethod.class differ diff --git a/bin/com/interview/java8/methodreferences/ReferenceToStaticMethod.class b/bin/com/interview/java8/methodreferences/ReferenceToStaticMethod.class index 1f2e2c0..ddb25a2 100644 Binary files a/bin/com/interview/java8/methodreferences/ReferenceToStaticMethod.class and b/bin/com/interview/java8/methodreferences/ReferenceToStaticMethod.class differ diff --git a/bin/com/interview/java8/methodreferences/ReferenceToStaticMethod2.class b/bin/com/interview/java8/methodreferences/ReferenceToStaticMethod2.class index 0302677..7d06df4 100644 Binary files a/bin/com/interview/java8/methodreferences/ReferenceToStaticMethod2.class and b/bin/com/interview/java8/methodreferences/ReferenceToStaticMethod2.class differ diff --git a/bin/com/interview/java8/methodreferences/Sayable.class b/bin/com/interview/java8/methodreferences/Sayable.class index 87703da..d87064c 100644 Binary files a/bin/com/interview/java8/methodreferences/Sayable.class and b/bin/com/interview/java8/methodreferences/Sayable.class differ diff --git a/bin/com/interview/java8/streamAPI/ConvertListToMap.class b/bin/com/interview/java8/streamAPI/ConvertListToMap.class index 17d83d9..910afb9 100644 Binary files a/bin/com/interview/java8/streamAPI/ConvertListToMap.class and b/bin/com/interview/java8/streamAPI/ConvertListToMap.class differ diff --git a/bin/com/interview/java8/streamAPI/ConvertListToSet.class b/bin/com/interview/java8/streamAPI/ConvertListToSet.class index 11e37f1..898c8c7 100644 Binary files a/bin/com/interview/java8/streamAPI/ConvertListToSet.class and b/bin/com/interview/java8/streamAPI/ConvertListToSet.class differ diff --git a/bin/com/interview/java8/streamAPI/FilteringAndIteratingCollection.class b/bin/com/interview/java8/streamAPI/FilteringAndIteratingCollection.class index 77c2803..a8812fb 100644 Binary files a/bin/com/interview/java8/streamAPI/FilteringAndIteratingCollection.class and b/bin/com/interview/java8/streamAPI/FilteringAndIteratingCollection.class differ diff --git a/bin/com/interview/java8/streamAPI/FindMaxAndMinMethods.class b/bin/com/interview/java8/streamAPI/FindMaxAndMinMethods.class index 8bd930a..70b3b8f 100644 Binary files a/bin/com/interview/java8/streamAPI/FindMaxAndMinMethods.class and b/bin/com/interview/java8/streamAPI/FindMaxAndMinMethods.class differ diff --git a/bin/com/interview/java8/streamAPI/JavaStreamExample.class b/bin/com/interview/java8/streamAPI/JavaStreamExample.class index 84ffdf4..088c4a5 100644 Binary files a/bin/com/interview/java8/streamAPI/JavaStreamExample.class and b/bin/com/interview/java8/streamAPI/JavaStreamExample.class differ diff --git a/bin/com/interview/java8/streamAPI/MethodReferenceInStream.class b/bin/com/interview/java8/streamAPI/MethodReferenceInStream.class index d7a8d93..dd92d4f 100644 Binary files a/bin/com/interview/java8/streamAPI/MethodReferenceInStream.class and b/bin/com/interview/java8/streamAPI/MethodReferenceInStream.class differ diff --git a/bin/com/interview/java8/streamAPI/Product.class b/bin/com/interview/java8/streamAPI/Product.class index c0101d3..53c0daf 100644 Binary files a/bin/com/interview/java8/streamAPI/Product.class and b/bin/com/interview/java8/streamAPI/Product.class differ diff --git a/bin/com/interview/java8/streamAPI/SumByUsingCollectorsMethods.class b/bin/com/interview/java8/streamAPI/SumByUsingCollectorsMethods.class index 3038693..1038336 100644 Binary files a/bin/com/interview/java8/streamAPI/SumByUsingCollectorsMethods.class and b/bin/com/interview/java8/streamAPI/SumByUsingCollectorsMethods.class differ diff --git a/bin/com/interview/javaconceptoftheday/Employee.class b/bin/com/interview/javaconceptoftheday/Employee.class index ed85eaf..a580fba 100644 Binary files a/bin/com/interview/javaconceptoftheday/Employee.class and b/bin/com/interview/javaconceptoftheday/Employee.class differ diff --git a/bin/com/interview/javaconceptoftheday/EmployeeManagmentJavaEight.class b/bin/com/interview/javaconceptoftheday/EmployeeManagmentJavaEight.class index 32f9f0e..6a21a63 100644 Binary files a/bin/com/interview/javaconceptoftheday/EmployeeManagmentJavaEight.class and b/bin/com/interview/javaconceptoftheday/EmployeeManagmentJavaEight.class differ diff --git a/bin/com/interview/javaconceptoftheday/GroupByRanking.class b/bin/com/interview/javaconceptoftheday/GroupByRanking.class index 4cf8eef..b831371 100644 Binary files a/bin/com/interview/javaconceptoftheday/GroupByRanking.class and b/bin/com/interview/javaconceptoftheday/GroupByRanking.class differ diff --git a/bin/com/interview/javaconceptoftheday/House.class b/bin/com/interview/javaconceptoftheday/House.class index 05dd325..f449a5b 100644 Binary files a/bin/com/interview/javaconceptoftheday/House.class and b/bin/com/interview/javaconceptoftheday/House.class differ diff --git a/bin/com/interview/javaconceptoftheday/HouseLoan.class b/bin/com/interview/javaconceptoftheday/HouseLoan.class index 26f12e6..3dcb85a 100644 Binary files a/bin/com/interview/javaconceptoftheday/HouseLoan.class and b/bin/com/interview/javaconceptoftheday/HouseLoan.class differ diff --git a/bin/com/interview/javaconceptoftheday/OptionalExample.class b/bin/com/interview/javaconceptoftheday/OptionalExample.class index 9b6d899..877878e 100644 Binary files a/bin/com/interview/javaconceptoftheday/OptionalExample.class and b/bin/com/interview/javaconceptoftheday/OptionalExample.class differ diff --git a/bin/com/interview/javaconceptoftheday/Person.class b/bin/com/interview/javaconceptoftheday/Person.class index 5cb6f43..b37f447 100644 Binary files a/bin/com/interview/javaconceptoftheday/Person.class and b/bin/com/interview/javaconceptoftheday/Person.class differ diff --git a/bin/com/interview/javaconceptoftheday/StreamExample.class b/bin/com/interview/javaconceptoftheday/StreamExample.class index 3bfe987..ab83db0 100644 Binary files a/bin/com/interview/javaconceptoftheday/StreamExample.class and b/bin/com/interview/javaconceptoftheday/StreamExample.class differ diff --git a/bin/com/interview/javaconceptoftheday/Student.class b/bin/com/interview/javaconceptoftheday/Student.class index 7df9acc..0b0353c 100644 Binary files a/bin/com/interview/javaconceptoftheday/Student.class and b/bin/com/interview/javaconceptoftheday/Student.class differ diff --git a/bin/com/interview/javaconceptoftheday/string/SortSingleLineTextFile.class b/bin/com/interview/javaconceptoftheday/string/SortSingleLineTextFile.class index 9e1acc1..6d5827d 100644 Binary files a/bin/com/interview/javaconceptoftheday/string/SortSingleLineTextFile.class and b/bin/com/interview/javaconceptoftheday/string/SortSingleLineTextFile.class differ diff --git a/bin/com/interview/josh/CountWordOccuranceNormally.class b/bin/com/interview/josh/CountWordOccuranceNormally.class deleted file mode 100644 index 437a34a..0000000 Binary files a/bin/com/interview/josh/CountWordOccuranceNormally.class and /dev/null differ diff --git a/bin/com/interview/lambdaex/Drawable.class b/bin/com/interview/lambdaex/Drawable.class index 5db25ee..fba8cbf 100644 Binary files a/bin/com/interview/lambdaex/Drawable.class and b/bin/com/interview/lambdaex/Drawable.class differ diff --git a/bin/com/interview/lambdaex/Drawables.class b/bin/com/interview/lambdaex/Drawables.class index c8c7bd3..b710d17 100644 Binary files a/bin/com/interview/lambdaex/Drawables.class and b/bin/com/interview/lambdaex/Drawables.class differ diff --git a/bin/com/interview/lambdaex/LambdaExpressionExamples$1.class b/bin/com/interview/lambdaex/LambdaExpressionExamples$1.class index 236092c..d768df0 100644 Binary files a/bin/com/interview/lambdaex/LambdaExpressionExamples$1.class and b/bin/com/interview/lambdaex/LambdaExpressionExamples$1.class differ diff --git a/bin/com/interview/lambdaex/LambdaExpressionExamples.class b/bin/com/interview/lambdaex/LambdaExpressionExamples.class index 5f69505..25da90b 100644 Binary files a/bin/com/interview/lambdaex/LambdaExpressionExamples.class and b/bin/com/interview/lambdaex/LambdaExpressionExamples.class differ diff --git a/bin/com/interview/lambdaex/LamdaExample.class b/bin/com/interview/lambdaex/LamdaExample.class index 59b5895..0faadd4 100644 Binary files a/bin/com/interview/lambdaex/LamdaExample.class and b/bin/com/interview/lambdaex/LamdaExample.class differ diff --git a/bin/com/interview/lambdaex/Stringstest.class b/bin/com/interview/lambdaex/Stringstest.class index 9f20d5a..902609f 100644 Binary files a/bin/com/interview/lambdaex/Stringstest.class and b/bin/com/interview/lambdaex/Stringstest.class differ diff --git a/bin/com/interview/lambdaex/strs.class b/bin/com/interview/lambdaex/strs.class index b641b47..10219bd 100644 Binary files a/bin/com/interview/lambdaex/strs.class and b/bin/com/interview/lambdaex/strs.class differ diff --git a/bin/com/interview/lang/CheckAnagramOrNot.class b/bin/com/interview/lang/CheckAnagramOrNot.class index 4752a51..a970635 100644 Binary files a/bin/com/interview/lang/CheckAnagramOrNot.class and b/bin/com/interview/lang/CheckAnagramOrNot.class differ diff --git a/bin/com/interview/lang/Dog.class b/bin/com/interview/lang/Dog.class index 572034c..761be4a 100644 Binary files a/bin/com/interview/lang/Dog.class and b/bin/com/interview/lang/Dog.class differ diff --git a/bin/com/interview/lang/PalindromCheckString.class b/bin/com/interview/lang/PalindromCheckString.class index 2a3c3b1..3405ac0 100644 Binary files a/bin/com/interview/lang/PalindromCheckString.class and b/bin/com/interview/lang/PalindromCheckString.class differ diff --git a/bin/com/interview/lang/PrintDuplicateStrings.class b/bin/com/interview/lang/PrintDuplicateStrings.class index 3f3e4d9..6d634b9 100644 Binary files a/bin/com/interview/lang/PrintDuplicateStrings.class and b/bin/com/interview/lang/PrintDuplicateStrings.class differ diff --git a/bin/com/interview/lang/SerializationExample.class b/bin/com/interview/lang/SerializationExample.class index 17d6e32..6451d12 100644 Binary files a/bin/com/interview/lang/SerializationExample.class and b/bin/com/interview/lang/SerializationExample.class differ diff --git a/bin/com/interview/lang/TypeCastingDownCastingAndUpcasting.class b/bin/com/interview/lang/TypeCastingDownCastingAndUpcasting.class index a70a64a..6e563a5 100644 Binary files a/bin/com/interview/lang/TypeCastingDownCastingAndUpcasting.class and b/bin/com/interview/lang/TypeCastingDownCastingAndUpcasting.class differ diff --git a/bin/com/interview/list/ArrayListExersice.class b/bin/com/interview/list/ArrayListExersice.class new file mode 100644 index 0000000..eadf244 Binary files /dev/null and b/bin/com/interview/list/ArrayListExersice.class differ diff --git a/bin/com/interview/list/ListTets.class b/bin/com/interview/list/ListTets.class index 86bdaf6..d460044 100644 Binary files a/bin/com/interview/list/ListTets.class and b/bin/com/interview/list/ListTets.class differ diff --git a/bin/com/interview/map/Child.class b/bin/com/interview/map/Child.class index be3a152..d50c358 100644 Binary files a/bin/com/interview/map/Child.class and b/bin/com/interview/map/Child.class differ diff --git a/bin/com/interview/map/EmployeeMap.class b/bin/com/interview/map/EmployeeMap.class index 2eea74d..8a82c3f 100644 Binary files a/bin/com/interview/map/EmployeeMap.class and b/bin/com/interview/map/EmployeeMap.class differ diff --git a/bin/com/interview/map/FlatMapExample.class b/bin/com/interview/map/FlatMapExample.class index a59b7a6..5c409fb 100644 Binary files a/bin/com/interview/map/FlatMapExample.class and b/bin/com/interview/map/FlatMapExample.class differ diff --git a/bin/com/interview/map/MapFiltering.class b/bin/com/interview/map/MapFiltering.class index faebfd2..eee655f 100644 Binary files a/bin/com/interview/map/MapFiltering.class and b/bin/com/interview/map/MapFiltering.class differ diff --git a/bin/com/interview/map/MapIterator.class b/bin/com/interview/map/MapIterator.class index aaa69a1..6edcf31 100644 Binary files a/bin/com/interview/map/MapIterator.class and b/bin/com/interview/map/MapIterator.class differ diff --git a/bin/com/interview/map/MapVsFlatMap.class b/bin/com/interview/map/MapVsFlatMap.class index 3b8b78d..f941252 100644 Binary files a/bin/com/interview/map/MapVsFlatMap.class and b/bin/com/interview/map/MapVsFlatMap.class differ diff --git a/bin/com/interview/map/Parent.class b/bin/com/interview/map/Parent.class index 2369c4a..7927855 100644 Binary files a/bin/com/interview/map/Parent.class and b/bin/com/interview/map/Parent.class differ diff --git a/bin/com/interview/map/SortHashMapByValue.class b/bin/com/interview/map/SortHashMapByValue.class index 622dd1b..a22ae88 100644 Binary files a/bin/com/interview/map/SortHashMapByValue.class and b/bin/com/interview/map/SortHashMapByValue.class differ diff --git a/bin/com/interview/map/TestMapSize.class b/bin/com/interview/map/TestMapSize.class index d7fac65..d495beb 100644 Binary files a/bin/com/interview/map/TestMapSize.class and b/bin/com/interview/map/TestMapSize.class differ diff --git a/bin/com/interview/mphasis/RemoveDuplicateCharacterFromString.class b/bin/com/interview/mphasis/RemoveDuplicateCharacterFromString.class deleted file mode 100644 index 96f1f59..0000000 Binary files a/bin/com/interview/mphasis/RemoveDuplicateCharacterFromString.class and /dev/null differ diff --git a/bin/com/interview/neosoft/PrintDuplicateValuesFromSet.class b/bin/com/interview/neosoft/PrintDuplicateValuesFromSet.class deleted file mode 100644 index 9d68ee8..0000000 Binary files a/bin/com/interview/neosoft/PrintDuplicateValuesFromSet.class and /dev/null differ diff --git a/bin/com/interview/object/classes/JavafinalizeExample.class b/bin/com/interview/object/classes/JavafinalizeExample.class index ddca1ee..869be66 100644 Binary files a/bin/com/interview/object/classes/JavafinalizeExample.class and b/bin/com/interview/object/classes/JavafinalizeExample.class differ diff --git a/bin/com/interview/object/classes/MyClass.class b/bin/com/interview/object/classes/MyClass.class index 262c87a..544d847 100644 Binary files a/bin/com/interview/object/classes/MyClass.class and b/bin/com/interview/object/classes/MyClass.class differ diff --git a/bin/com/interview/object/classes/Test.class b/bin/com/interview/object/classes/Test.class index 61c2bb3..21d1ce2 100644 Binary files a/bin/com/interview/object/classes/Test.class and b/bin/com/interview/object/classes/Test.class differ diff --git a/bin/com/interview/objectsorting/ComparableComparatorTest.class b/bin/com/interview/objectsorting/ComparableComparatorTest.class index 4911b98..19e8db8 100644 Binary files a/bin/com/interview/objectsorting/ComparableComparatorTest.class and b/bin/com/interview/objectsorting/ComparableComparatorTest.class differ diff --git a/bin/com/interview/objectsorting/ComparableExample.class b/bin/com/interview/objectsorting/ComparableExample.class index c3231cc..9971903 100644 Binary files a/bin/com/interview/objectsorting/ComparableExample.class and b/bin/com/interview/objectsorting/ComparableExample.class differ diff --git a/bin/com/interview/objectsorting/ComparableStudentSorting$1.class b/bin/com/interview/objectsorting/ComparableStudentSorting$1.class index 746ddcf..4a5da62 100644 Binary files a/bin/com/interview/objectsorting/ComparableStudentSorting$1.class and b/bin/com/interview/objectsorting/ComparableStudentSorting$1.class differ diff --git a/bin/com/interview/objectsorting/ComparableStudentSorting.class b/bin/com/interview/objectsorting/ComparableStudentSorting.class index 29b8a70..6c21b98 100644 Binary files a/bin/com/interview/objectsorting/ComparableStudentSorting.class and b/bin/com/interview/objectsorting/ComparableStudentSorting.class differ diff --git a/bin/com/interview/objectsorting/ComparableTest.class b/bin/com/interview/objectsorting/ComparableTest.class index 6bc16d4..417c176 100644 Binary files a/bin/com/interview/objectsorting/ComparableTest.class and b/bin/com/interview/objectsorting/ComparableTest.class differ diff --git a/bin/com/interview/objectsorting/ComparatorExample$1.class b/bin/com/interview/objectsorting/ComparatorExample$1.class index 72a251e..c7c04c1 100644 Binary files a/bin/com/interview/objectsorting/ComparatorExample$1.class and b/bin/com/interview/objectsorting/ComparatorExample$1.class differ diff --git a/bin/com/interview/objectsorting/ComparatorExample.class b/bin/com/interview/objectsorting/ComparatorExample.class index 4a65461..8bebd2e 100644 Binary files a/bin/com/interview/objectsorting/ComparatorExample.class and b/bin/com/interview/objectsorting/ComparatorExample.class differ diff --git a/bin/com/interview/objectsorting/ComparatorTests.class b/bin/com/interview/objectsorting/ComparatorTests.class index c71ec8a..6194ebb 100644 Binary files a/bin/com/interview/objectsorting/ComparatorTests.class and b/bin/com/interview/objectsorting/ComparatorTests.class differ diff --git a/bin/com/interview/objectsorting/Employee$1.class b/bin/com/interview/objectsorting/Employee$1.class index cd51a7d..46a13c5 100644 Binary files a/bin/com/interview/objectsorting/Employee$1.class and b/bin/com/interview/objectsorting/Employee$1.class differ diff --git a/bin/com/interview/objectsorting/Employee$2.class b/bin/com/interview/objectsorting/Employee$2.class index a6491b7..dd0344a 100644 Binary files a/bin/com/interview/objectsorting/Employee$2.class and b/bin/com/interview/objectsorting/Employee$2.class differ diff --git a/bin/com/interview/objectsorting/Employee$3.class b/bin/com/interview/objectsorting/Employee$3.class index 53347c5..9b5fce6 100644 Binary files a/bin/com/interview/objectsorting/Employee$3.class and b/bin/com/interview/objectsorting/Employee$3.class differ diff --git a/bin/com/interview/objectsorting/Employee$4.class b/bin/com/interview/objectsorting/Employee$4.class index ee25236..b99e954 100644 Binary files a/bin/com/interview/objectsorting/Employee$4.class and b/bin/com/interview/objectsorting/Employee$4.class differ diff --git a/bin/com/interview/objectsorting/Employee.class b/bin/com/interview/objectsorting/Employee.class index 46bc91a..c951f1e 100644 Binary files a/bin/com/interview/objectsorting/Employee.class and b/bin/com/interview/objectsorting/Employee.class differ diff --git a/bin/com/interview/objectsorting/EmployeeConceptOfTheDay.class b/bin/com/interview/objectsorting/EmployeeConceptOfTheDay.class index 5e3ea96..66d0f44 100644 Binary files a/bin/com/interview/objectsorting/EmployeeConceptOfTheDay.class and b/bin/com/interview/objectsorting/EmployeeConceptOfTheDay.class differ diff --git a/bin/com/interview/objectsorting/EmployeeStreamExamples.class b/bin/com/interview/objectsorting/EmployeeStreamExamples.class index cd2537a..00bafd1 100644 Binary files a/bin/com/interview/objectsorting/EmployeeStreamExamples.class and b/bin/com/interview/objectsorting/EmployeeStreamExamples.class differ diff --git a/bin/com/interview/objectsorting/EmployeeThird.class b/bin/com/interview/objectsorting/EmployeeThird.class index dc78e19..4469f97 100644 Binary files a/bin/com/interview/objectsorting/EmployeeThird.class and b/bin/com/interview/objectsorting/EmployeeThird.class differ diff --git a/bin/com/interview/objectsorting/Employee_One.class b/bin/com/interview/objectsorting/Employee_One.class index c9e0e10..913d51a 100644 Binary files a/bin/com/interview/objectsorting/Employee_One.class and b/bin/com/interview/objectsorting/Employee_One.class differ diff --git a/bin/com/interview/objectsorting/Employees.class b/bin/com/interview/objectsorting/Employees.class index 62c9791..9c4a6ea 100644 Binary files a/bin/com/interview/objectsorting/Employees.class and b/bin/com/interview/objectsorting/Employees.class differ diff --git a/bin/com/interview/objectsorting/FindMaxAge.class b/bin/com/interview/objectsorting/FindMaxAge.class index 26da550..ed4a91d 100644 Binary files a/bin/com/interview/objectsorting/FindMaxAge.class and b/bin/com/interview/objectsorting/FindMaxAge.class differ diff --git a/bin/com/interview/objectsorting/Person.class b/bin/com/interview/objectsorting/Person.class index 630fb7a..bf2291e 100644 Binary files a/bin/com/interview/objectsorting/Person.class and b/bin/com/interview/objectsorting/Person.class differ diff --git a/bin/com/interview/objectsorting/SortAscEmployeeBasedOnSalary.class b/bin/com/interview/objectsorting/SortAscEmployeeBasedOnSalary.class index ef6b2a4..4aa399b 100644 Binary files a/bin/com/interview/objectsorting/SortAscEmployeeBasedOnSalary.class and b/bin/com/interview/objectsorting/SortAscEmployeeBasedOnSalary.class differ diff --git a/bin/com/interview/objectsorting/SortByEmpName.class b/bin/com/interview/objectsorting/SortByEmpName.class index 07779e1..7d33857 100644 Binary files a/bin/com/interview/objectsorting/SortByEmpName.class and b/bin/com/interview/objectsorting/SortByEmpName.class differ diff --git a/bin/com/interview/objectsorting/Sortbyname.class b/bin/com/interview/objectsorting/Sortbyname.class index 7190686..19d9438 100644 Binary files a/bin/com/interview/objectsorting/Sortbyname.class and b/bin/com/interview/objectsorting/Sortbyname.class differ diff --git a/bin/com/interview/objectsorting/Sortbyroll.class b/bin/com/interview/objectsorting/Sortbyroll.class index 7db8382..73a69d4 100644 Binary files a/bin/com/interview/objectsorting/Sortbyroll.class and b/bin/com/interview/objectsorting/Sortbyroll.class differ diff --git a/bin/com/interview/objectsorting/Student.class b/bin/com/interview/objectsorting/Student.class index eb6ee6f..725a5c0 100644 Binary files a/bin/com/interview/objectsorting/Student.class and b/bin/com/interview/objectsorting/Student.class differ diff --git a/bin/com/interview/objectsorting/ThirdLargestSalary.class b/bin/com/interview/objectsorting/ThirdLargestSalary.class index 24ffb17..3b6c634 100644 Binary files a/bin/com/interview/objectsorting/ThirdLargestSalary.class and b/bin/com/interview/objectsorting/ThirdLargestSalary.class differ diff --git a/bin/com/interview/objectsorting/User.class b/bin/com/interview/objectsorting/User.class index 10f7bf3..643342d 100644 Binary files a/bin/com/interview/objectsorting/User.class and b/bin/com/interview/objectsorting/User.class differ diff --git a/bin/com/interview/optional/OptionalExample.class b/bin/com/interview/optional/OptionalExample.class index 0e736ec..0f1db6a 100644 Binary files a/bin/com/interview/optional/OptionalExample.class and b/bin/com/interview/optional/OptionalExample.class differ diff --git a/bin/com/interview/overriding/Child.class b/bin/com/interview/overriding/Child.class deleted file mode 100644 index 41a773c..0000000 Binary files a/bin/com/interview/overriding/Child.class and /dev/null differ diff --git a/bin/com/interview/overriding/Parent.class b/bin/com/interview/overriding/Parent.class deleted file mode 100644 index 35599a9..0000000 Binary files a/bin/com/interview/overriding/Parent.class and /dev/null differ diff --git a/bin/com/predicates/PredicateExample.class b/bin/com/interview/predicate/PredicateExample.class similarity index 89% rename from bin/com/predicates/PredicateExample.class rename to bin/com/interview/predicate/PredicateExample.class index 4a4ebe8..a76ddc3 100644 Binary files a/bin/com/predicates/PredicateExample.class and b/bin/com/interview/predicate/PredicateExample.class differ diff --git a/bin/com/interview/predicate/Predicates.class b/bin/com/interview/predicate/Predicates.class new file mode 100644 index 0000000..2087150 Binary files /dev/null and b/bin/com/interview/predicate/Predicates.class differ diff --git a/bin/com/predicates/Student.class b/bin/com/interview/predicate/Student.class similarity index 72% rename from bin/com/predicates/Student.class rename to bin/com/interview/predicate/Student.class index b013e38..c05de97 100644 Binary files a/bin/com/predicates/Student.class and b/bin/com/interview/predicate/Student.class differ diff --git a/bin/com/interview/puresoftware/ReverseListByDescendingOrder.class b/bin/com/interview/puresoftware/ReverseListByDescendingOrder.class deleted file mode 100644 index 4bef559..0000000 Binary files a/bin/com/interview/puresoftware/ReverseListByDescendingOrder.class and /dev/null differ diff --git a/bin/com/interview/puresoftware/SortListOfAlphaNumericStringOnTheBasisOfNumber.class b/bin/com/interview/puresoftware/SortListOfAlphaNumericStringOnTheBasisOfNumber.class deleted file mode 100644 index 8ee1fb2..0000000 Binary files a/bin/com/interview/puresoftware/SortListOfAlphaNumericStringOnTheBasisOfNumber.class and /dev/null differ diff --git a/bin/com/interview/set/Test.class b/bin/com/interview/set/Test.class index 0294b68..222782f 100644 Binary files a/bin/com/interview/set/Test.class and b/bin/com/interview/set/Test.class differ diff --git a/bin/com/interview/singleton/preventing/CloningSingleton.class b/bin/com/interview/singleton/preventing/CloningSingleton.class index f520ba0..9ccb435 100644 Binary files a/bin/com/interview/singleton/preventing/CloningSingleton.class and b/bin/com/interview/singleton/preventing/CloningSingleton.class differ diff --git a/bin/com/interview/singleton/preventing/DeserializationSingleton.class b/bin/com/interview/singleton/preventing/DeserializationSingleton.class index 9bec03a..42728f3 100644 Binary files a/bin/com/interview/singleton/preventing/DeserializationSingleton.class and b/bin/com/interview/singleton/preventing/DeserializationSingleton.class differ diff --git a/bin/com/interview/singleton/preventing/ReflectionSingleton.class b/bin/com/interview/singleton/preventing/ReflectionSingleton.class index d5b27ea..23e725f 100644 Binary files a/bin/com/interview/singleton/preventing/ReflectionSingleton.class and b/bin/com/interview/singleton/preventing/ReflectionSingleton.class differ diff --git a/bin/com/interview/singleton/preventing/Singleton.class b/bin/com/interview/singleton/preventing/Singleton.class index 156f8cb..530bffc 100644 Binary files a/bin/com/interview/singleton/preventing/Singleton.class and b/bin/com/interview/singleton/preventing/Singleton.class differ diff --git a/bin/com/interview/singleton/preventing/SingletonPattern.class b/bin/com/interview/singleton/preventing/SingletonPattern.class new file mode 100644 index 0000000..5835a20 Binary files /dev/null and b/bin/com/interview/singleton/preventing/SingletonPattern.class differ diff --git a/bin/com/interview/singleton/preventing/SingletonTest.class b/bin/com/interview/singleton/preventing/SingletonTest.class index 72d5e93..8a43cf6 100644 Binary files a/bin/com/interview/singleton/preventing/SingletonTest.class and b/bin/com/interview/singleton/preventing/SingletonTest.class differ diff --git a/bin/com/interview/staticblock/test/StaticBlockTest.class b/bin/com/interview/staticblock/test/StaticBlockTest.class index 36a0507..75d0428 100644 Binary files a/bin/com/interview/staticblock/test/StaticBlockTest.class and b/bin/com/interview/staticblock/test/StaticBlockTest.class differ diff --git a/bin/com/interview/staticblock/test/StaticFlowParentChild.class b/bin/com/interview/staticblock/test/StaticFlowParentChild.class index f14eb1d..1c8a751 100644 Binary files a/bin/com/interview/staticblock/test/StaticFlowParentChild.class and b/bin/com/interview/staticblock/test/StaticFlowParentChild.class differ diff --git a/bin/com/interview/stream/DifferentKindOfStream.class b/bin/com/interview/stream/DifferentKindOfStream.class index 68c01fb..085d293 100644 Binary files a/bin/com/interview/stream/DifferentKindOfStream.class and b/bin/com/interview/stream/DifferentKindOfStream.class differ diff --git a/bin/com/interview/stream/Employee.class b/bin/com/interview/stream/Employee.class index 0d4de0a..5b57e3d 100644 Binary files a/bin/com/interview/stream/Employee.class and b/bin/com/interview/stream/Employee.class differ diff --git a/bin/com/interview/stream/EmployeeStreamExamples.class b/bin/com/interview/stream/EmployeeStreamExamples.class index 67e1b85..2da46a0 100644 Binary files a/bin/com/interview/stream/EmployeeStreamExamples.class and b/bin/com/interview/stream/EmployeeStreamExamples.class differ diff --git a/bin/com/interview/stream/FindMaxAge.class b/bin/com/interview/stream/FindMaxAge.class index 382024c..825bc20 100644 Binary files a/bin/com/interview/stream/FindMaxAge.class and b/bin/com/interview/stream/FindMaxAge.class differ diff --git a/bin/com/interview/stream/MaxCharacterOccurance.class b/bin/com/interview/stream/MaxCharacterOccurance.class index 9bc26a3..8d69858 100644 Binary files a/bin/com/interview/stream/MaxCharacterOccurance.class and b/bin/com/interview/stream/MaxCharacterOccurance.class differ diff --git a/bin/com/interview/stream/Person.class b/bin/com/interview/stream/Person.class index 8c47508..e83ce37 100644 Binary files a/bin/com/interview/stream/Person.class and b/bin/com/interview/stream/Person.class differ diff --git a/bin/com/interview/stream/Product.class b/bin/com/interview/stream/Product.class index f0a6716..690bdff 100644 Binary files a/bin/com/interview/stream/Product.class and b/bin/com/interview/stream/Product.class differ diff --git a/bin/com/interview/stream/StreamExample.class b/bin/com/interview/stream/StreamExample.class index 62da64f..233bd3a 100644 Binary files a/bin/com/interview/stream/StreamExample.class and b/bin/com/interview/stream/StreamExample.class differ diff --git a/bin/com/interview/stream/StreamExamples.class b/bin/com/interview/stream/StreamExamples.class index 526fe8c..0ef7e8b 100644 Binary files a/bin/com/interview/stream/StreamExamples.class and b/bin/com/interview/stream/StreamExamples.class differ diff --git a/bin/com/interview/stream/StreamFunctions.class b/bin/com/interview/stream/StreamFunctions.class index 25a2ab0..0cb6160 100644 Binary files a/bin/com/interview/stream/StreamFunctions.class and b/bin/com/interview/stream/StreamFunctions.class differ diff --git a/bin/com/interview/stream/User.class b/bin/com/interview/stream/User.class index fd629d1..13a8491 100644 Binary files a/bin/com/interview/stream/User.class and b/bin/com/interview/stream/User.class differ diff --git a/bin/com/interview/strings/CheckAnagramOrNot.class b/bin/com/interview/strings/CheckAnagramOrNot.class index d15ecf9..122cd46 100644 Binary files a/bin/com/interview/strings/CheckAnagramOrNot.class and b/bin/com/interview/strings/CheckAnagramOrNot.class differ diff --git a/bin/com/interview/strings/CountCharacterBySequence.class b/bin/com/interview/strings/CountCharacterBySequence.class index 2b3e7da..b59c137 100644 Binary files a/bin/com/interview/strings/CountCharacterBySequence.class and b/bin/com/interview/strings/CountCharacterBySequence.class differ diff --git a/bin/com/interview/strings/Demo.class b/bin/com/interview/strings/Demo.class index f3d18d0..af6df55 100644 Binary files a/bin/com/interview/strings/Demo.class and b/bin/com/interview/strings/Demo.class differ diff --git a/bin/com/interview/strings/FindDuplicateCharacterFromString.class b/bin/com/interview/strings/FindDuplicateCharacterFromString.class index 213e5d6..7e2e9d1 100644 Binary files a/bin/com/interview/strings/FindDuplicateCharacterFromString.class and b/bin/com/interview/strings/FindDuplicateCharacterFromString.class differ diff --git a/bin/com/interview/strings/HarryPotterStringCut.class b/bin/com/interview/strings/HarryPotterStringCut.class index 1b6fd5c..2c53331 100644 Binary files a/bin/com/interview/strings/HarryPotterStringCut.class and b/bin/com/interview/strings/HarryPotterStringCut.class differ diff --git a/bin/com/interview/strings/ImmutableStringExample.class b/bin/com/interview/strings/ImmutableStringExample.class new file mode 100644 index 0000000..82857ba Binary files /dev/null and b/bin/com/interview/strings/ImmutableStringExample.class differ diff --git a/bin/com/interview/strings/MostOccurenceStringInList.class b/bin/com/interview/strings/MostOccurenceStringInList.class index dcda038..62c57d0 100644 Binary files a/bin/com/interview/strings/MostOccurenceStringInList.class and b/bin/com/interview/strings/MostOccurenceStringInList.class differ diff --git a/bin/com/interview/strings/MultipleCallableTasksExample.class b/bin/com/interview/strings/MultipleCallableTasksExample.class new file mode 100644 index 0000000..b3abbef Binary files /dev/null and b/bin/com/interview/strings/MultipleCallableTasksExample.class differ diff --git a/bin/com/interview/strings/Palindrom.class b/bin/com/interview/strings/Palindrom.class index 9b6c7ab..4920aa1 100644 Binary files a/bin/com/interview/strings/Palindrom.class and b/bin/com/interview/strings/Palindrom.class differ diff --git a/bin/com/interview/strings/RemoveDuplicateCharacterFromString.class b/bin/com/interview/strings/RemoveDuplicateCharacterFromString.class index 291c137..c32fab1 100644 Binary files a/bin/com/interview/strings/RemoveDuplicateCharacterFromString.class and b/bin/com/interview/strings/RemoveDuplicateCharacterFromString.class differ diff --git a/bin/com/interview/strings/ReverseEachWordOfAString.class b/bin/com/interview/strings/ReverseEachWordOfAString.class index 3f2d2b4..2171aff 100644 Binary files a/bin/com/interview/strings/ReverseEachWordOfAString.class and b/bin/com/interview/strings/ReverseEachWordOfAString.class differ diff --git a/bin/com/interview/strings/Strings.class b/bin/com/interview/strings/Strings.class index 676d242..04b4e8a 100644 Binary files a/bin/com/interview/strings/Strings.class and b/bin/com/interview/strings/Strings.class differ diff --git a/bin/com/interview/strings/StringsTest.class b/bin/com/interview/strings/StringsTest.class index 77481ed..5bc73c5 100644 Binary files a/bin/com/interview/strings/StringsTest.class and b/bin/com/interview/strings/StringsTest.class differ diff --git a/bin/com/interview/strings/Student.class b/bin/com/interview/strings/Student.class index 471d55d..fb5eee4 100644 Binary files a/bin/com/interview/strings/Student.class and b/bin/com/interview/strings/Student.class differ diff --git a/bin/com/interview/threadpool/example/MyMonitorThread.class b/bin/com/interview/threadpool/example/MyMonitorThread.class index efe0cf0..dfdbf89 100644 Binary files a/bin/com/interview/threadpool/example/MyMonitorThread.class and b/bin/com/interview/threadpool/example/MyMonitorThread.class differ diff --git a/bin/com/interview/threadpool/example/RejectedExecutionHandlerImpl.class b/bin/com/interview/threadpool/example/RejectedExecutionHandlerImpl.class index 26b7434..e9604a7 100644 Binary files a/bin/com/interview/threadpool/example/RejectedExecutionHandlerImpl.class and b/bin/com/interview/threadpool/example/RejectedExecutionHandlerImpl.class differ diff --git a/bin/com/interview/threadpool/example/SimpleThreadPool.class b/bin/com/interview/threadpool/example/SimpleThreadPool.class index 8c8c49c..0cc0777 100644 Binary files a/bin/com/interview/threadpool/example/SimpleThreadPool.class and b/bin/com/interview/threadpool/example/SimpleThreadPool.class differ diff --git a/bin/com/interview/threadpool/example/WorkerPool.class b/bin/com/interview/threadpool/example/WorkerPool.class index f53713b..3cc01f2 100644 Binary files a/bin/com/interview/threadpool/example/WorkerPool.class and b/bin/com/interview/threadpool/example/WorkerPool.class differ diff --git a/bin/com/interview/threadpool/example/WorkerThread.class b/bin/com/interview/threadpool/example/WorkerThread.class index 79a65e0..61f85b6 100644 Binary files a/bin/com/interview/threadpool/example/WorkerThread.class and b/bin/com/interview/threadpool/example/WorkerThread.class differ diff --git a/bin/com/interview/threads/SetDaemonMethod.class b/bin/com/interview/threads/SetDaemonMethod.class new file mode 100644 index 0000000..d9de9ea Binary files /dev/null and b/bin/com/interview/threads/SetDaemonMethod.class differ diff --git a/bin/com/interview/threads/Test.class b/bin/com/interview/threads/Test.class index 5e6340a..7907036 100644 Binary files a/bin/com/interview/threads/Test.class and b/bin/com/interview/threads/Test.class differ diff --git a/bin/com/interview/threads/Test1.class b/bin/com/interview/threads/Test1.class new file mode 100644 index 0000000..4281707 Binary files /dev/null and b/bin/com/interview/threads/Test1.class differ diff --git a/bin/com/interview/threads/ThreadLifecycle.class b/bin/com/interview/threads/ThreadLifecycle.class new file mode 100644 index 0000000..4cf7654 Binary files /dev/null and b/bin/com/interview/threads/ThreadLifecycle.class differ diff --git a/bin/com/interview/threads/ThreadPriority.class b/bin/com/interview/threads/ThreadPriority.class new file mode 100644 index 0000000..687f0df Binary files /dev/null and b/bin/com/interview/threads/ThreadPriority.class differ diff --git a/bin/com/interview/threads/ThreadTest.class b/bin/com/interview/threads/ThreadTest.class index 7b803b6..18e1515 100644 Binary files a/bin/com/interview/threads/ThreadTest.class and b/bin/com/interview/threads/ThreadTest.class differ diff --git a/bin/com/interview/threads/World.class b/bin/com/interview/threads/World.class new file mode 100644 index 0000000..619abf0 Binary files /dev/null and b/bin/com/interview/threads/World.class differ diff --git a/bin/com/interview/threads/World1.class b/bin/com/interview/threads/World1.class new file mode 100644 index 0000000..c37f5e7 Binary files /dev/null and b/bin/com/interview/threads/World1.class differ diff --git a/bin/com/interview/threads/YieldMethod.class b/bin/com/interview/threads/YieldMethod.class new file mode 100644 index 0000000..eeda488 Binary files /dev/null and b/bin/com/interview/threads/YieldMethod.class differ diff --git a/bin/com/interview/volkasvegon/Singleton.class b/bin/com/interview/volkasvegon/Singleton.class deleted file mode 100644 index 90eecc4..0000000 Binary files a/bin/com/interview/volkasvegon/Singleton.class and /dev/null differ diff --git a/bin/com/interviews/AllInterviewsPrograms.class b/bin/com/interviews/AllInterviewsPrograms.class deleted file mode 100644 index 6e5ee79..0000000 Binary files a/bin/com/interviews/AllInterviewsPrograms.class and /dev/null differ diff --git a/bin/com/interviews/AnagramProgram.class b/bin/com/interviews/AnagramProgram.class deleted file mode 100644 index 2ac8973..0000000 Binary files a/bin/com/interviews/AnagramProgram.class and /dev/null differ diff --git a/bin/com/interviews/CharacterOccuranceCount.class b/bin/com/interviews/CharacterOccuranceCount.class deleted file mode 100644 index 013579b..0000000 Binary files a/bin/com/interviews/CharacterOccuranceCount.class and /dev/null differ diff --git a/bin/com/interviews/CheckPalindromStrings.class b/bin/com/interviews/CheckPalindromStrings.class deleted file mode 100644 index e745d21..0000000 Binary files a/bin/com/interviews/CheckPalindromStrings.class and /dev/null differ diff --git a/bin/com/interviews/FinalClassExample.class b/bin/com/interviews/FinalClassExample.class deleted file mode 100644 index a952fe9..0000000 Binary files a/bin/com/interviews/FinalClassExample.class and /dev/null differ diff --git a/bin/com/interviews/FindTheTargetOfSumValues.class b/bin/com/interviews/FindTheTargetOfSumValues.class deleted file mode 100644 index 1fefcd0..0000000 Binary files a/bin/com/interviews/FindTheTargetOfSumValues.class and /dev/null differ diff --git a/bin/com/interviews/MergeTwoListAndFindCommonValues.class b/bin/com/interviews/MergeTwoListAndFindCommonValues.class deleted file mode 100644 index 1878fbb..0000000 Binary files a/bin/com/interviews/MergeTwoListAndFindCommonValues.class and /dev/null differ diff --git a/bin/com/interviews/RemoveLaptopWordFromProduct.class b/bin/com/interviews/RemoveLaptopWordFromProduct.class deleted file mode 100644 index a60fe0d..0000000 Binary files a/bin/com/interviews/RemoveLaptopWordFromProduct.class and /dev/null differ diff --git a/bin/com/interviews/ShortStudentByRollNumber.class b/bin/com/interviews/ShortStudentByRollNumber.class deleted file mode 100644 index fe6176c..0000000 Binary files a/bin/com/interviews/ShortStudentByRollNumber.class and /dev/null differ diff --git a/bin/com/interviews/StringCompare.class b/bin/com/interviews/StringCompare.class deleted file mode 100644 index e968205..0000000 Binary files a/bin/com/interviews/StringCompare.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/CollectorsTest.class b/bin/com/javaconceptoftheday/CollectorsTest.class deleted file mode 100644 index cf445e3..0000000 Binary files a/bin/com/javaconceptoftheday/CollectorsTest.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/Employee.class b/bin/com/javaconceptoftheday/Employee.class deleted file mode 100644 index 8a48eb8..0000000 Binary files a/bin/com/javaconceptoftheday/Employee.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/ExceptionHandling.class b/bin/com/javaconceptoftheday/ExceptionHandling.class deleted file mode 100644 index 280e20c..0000000 Binary files a/bin/com/javaconceptoftheday/ExceptionHandling.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/JavaEightPrograms.class b/bin/com/javaconceptoftheday/JavaEightPrograms.class deleted file mode 100644 index 9339bfa..0000000 Binary files a/bin/com/javaconceptoftheday/JavaEightPrograms.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/SortHashMapByKeyNaturalOrder.class b/bin/com/javaconceptoftheday/SortHashMapByKeyNaturalOrder.class deleted file mode 100644 index 9e2f3b6..0000000 Binary files a/bin/com/javaconceptoftheday/SortHashMapByKeyNaturalOrder.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/Student.class b/bin/com/javaconceptoftheday/Student.class deleted file mode 100644 index 27c44a3..0000000 Binary files a/bin/com/javaconceptoftheday/Student.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/AnotherClass.class b/bin/com/javaconceptoftheday/thread/AnotherClass.class deleted file mode 100644 index 2daa4bf..0000000 Binary files a/bin/com/javaconceptoftheday/thread/AnotherClass.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/CreatingThread.class b/bin/com/javaconceptoftheday/thread/CreatingThread.class deleted file mode 100644 index 71e6d1d..0000000 Binary files a/bin/com/javaconceptoftheday/thread/CreatingThread.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/DifferentWaysToDifineThread.class b/bin/com/javaconceptoftheday/thread/DifferentWaysToDifineThread.class deleted file mode 100644 index ef7c739..0000000 Binary files a/bin/com/javaconceptoftheday/thread/DifferentWaysToDifineThread.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/Handle2MaxPriorityThreadInsingleToneClass.class b/bin/com/javaconceptoftheday/thread/Handle2MaxPriorityThreadInsingleToneClass.class deleted file mode 100644 index 22a1e04..0000000 Binary files a/bin/com/javaconceptoftheday/thread/Handle2MaxPriorityThreadInsingleToneClass.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/MyThread.class b/bin/com/javaconceptoftheday/thread/MyThread.class deleted file mode 100644 index 83ed3f8..0000000 Binary files a/bin/com/javaconceptoftheday/thread/MyThread.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/SingletonThreadManager.class b/bin/com/javaconceptoftheday/thread/SingletonThreadManager.class deleted file mode 100644 index 136e43f..0000000 Binary files a/bin/com/javaconceptoftheday/thread/SingletonThreadManager.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsALocalInnerClass$1MyThread1.class b/bin/com/javaconceptoftheday/thread/ThreadAsALocalInnerClass$1MyThread1.class deleted file mode 100644 index 75ce896..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsALocalInnerClass$1MyThread1.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsALocalInnerClass$1MyThread2.class b/bin/com/javaconceptoftheday/thread/ThreadAsALocalInnerClass$1MyThread2.class deleted file mode 100644 index 419095b..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsALocalInnerClass$1MyThread2.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsALocalInnerClass.class b/bin/com/javaconceptoftheday/thread/ThreadAsALocalInnerClass.class deleted file mode 100644 index 3729820..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsALocalInnerClass.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsAMemberInnerClassorNonStaticInnerClass$MyThread1.class b/bin/com/javaconceptoftheday/thread/ThreadAsAMemberInnerClassorNonStaticInnerClass$MyThread1.class deleted file mode 100644 index 30745d2..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsAMemberInnerClassorNonStaticInnerClass$MyThread1.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsAMemberInnerClassorNonStaticInnerClass$MyThread2.class b/bin/com/javaconceptoftheday/thread/ThreadAsAMemberInnerClassorNonStaticInnerClass$MyThread2.class deleted file mode 100644 index 640a4d0..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsAMemberInnerClassorNonStaticInnerClass$MyThread2.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsAMemberInnerClassorNonStaticInnerClass.class b/bin/com/javaconceptoftheday/thread/ThreadAsAMemberInnerClassorNonStaticInnerClass.class deleted file mode 100644 index ee94e01..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsAMemberInnerClassorNonStaticInnerClass.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsANestedClassorStaticInnerClass$MyThread1.class b/bin/com/javaconceptoftheday/thread/ThreadAsANestedClassorStaticInnerClass$MyThread1.class deleted file mode 100644 index 0a11eb6..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsANestedClassorStaticInnerClass$MyThread1.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsANestedClassorStaticInnerClass$MyThread2.class b/bin/com/javaconceptoftheday/thread/ThreadAsANestedClassorStaticInnerClass$MyThread2.class deleted file mode 100644 index 6e1007a..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsANestedClassorStaticInnerClass$MyThread2.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsANestedClassorStaticInnerClass.class b/bin/com/javaconceptoftheday/thread/ThreadAsANestedClassorStaticInnerClass.class deleted file mode 100644 index ae38aa6..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsANestedClassorStaticInnerClass.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsAnAnonymousInnerClass$1.class b/bin/com/javaconceptoftheday/thread/ThreadAsAnAnonymousInnerClass$1.class deleted file mode 100644 index 39e69f6..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsAnAnonymousInnerClass$1.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsAnAnonymousInnerClass$2.class b/bin/com/javaconceptoftheday/thread/ThreadAsAnAnonymousInnerClass$2.class deleted file mode 100644 index 0488dff..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsAnAnonymousInnerClass$2.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadAsAnAnonymousInnerClass.class b/bin/com/javaconceptoftheday/thread/ThreadAsAnAnonymousInnerClass.class deleted file mode 100644 index 1011cfa..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadAsAnAnonymousInnerClass.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadUingThreadClass.class b/bin/com/javaconceptoftheday/thread/ThreadUingThreadClass.class deleted file mode 100644 index 2ee8ebd..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadUingThreadClass.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/ThreadUsingRunnableInterface.class b/bin/com/javaconceptoftheday/thread/ThreadUsingRunnableInterface.class deleted file mode 100644 index 029868c..0000000 Binary files a/bin/com/javaconceptoftheday/thread/ThreadUsingRunnableInterface.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/UsageClassItselfAsaThreadClass.class b/bin/com/javaconceptoftheday/thread/UsageClassItselfAsaThreadClass.class deleted file mode 100644 index b12cc32..0000000 Binary files a/bin/com/javaconceptoftheday/thread/UsageClassItselfAsaThreadClass.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/UsageClassOne.class b/bin/com/javaconceptoftheday/thread/UsageClassOne.class deleted file mode 100644 index 47495f8..0000000 Binary files a/bin/com/javaconceptoftheday/thread/UsageClassOne.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/thread/UsageClassTwo.class b/bin/com/javaconceptoftheday/thread/UsageClassTwo.class deleted file mode 100644 index 0571299..0000000 Binary files a/bin/com/javaconceptoftheday/thread/UsageClassTwo.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/tricky/MethodOverloading.class b/bin/com/javaconceptoftheday/tricky/MethodOverloading.class deleted file mode 100644 index 6cf88f3..0000000 Binary files a/bin/com/javaconceptoftheday/tricky/MethodOverloading.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/tricky/T1.class b/bin/com/javaconceptoftheday/tricky/T1.class deleted file mode 100644 index 1b14db4..0000000 Binary files a/bin/com/javaconceptoftheday/tricky/T1.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/tricky/T2.class b/bin/com/javaconceptoftheday/tricky/T2.class deleted file mode 100644 index db33949..0000000 Binary files a/bin/com/javaconceptoftheday/tricky/T2.class and /dev/null differ diff --git a/bin/com/javaconceptoftheday/tricky/T3.class b/bin/com/javaconceptoftheday/tricky/T3.class deleted file mode 100644 index e14f3e9..0000000 Binary files a/bin/com/javaconceptoftheday/tricky/T3.class and /dev/null differ diff --git a/bin/com/javatechonline/Book.class b/bin/com/javatechonline/Book.class deleted file mode 100644 index fba81dc..0000000 Binary files a/bin/com/javatechonline/Book.class and /dev/null differ diff --git a/bin/com/javatechonline/quiz/GuessTheOutPut.class b/bin/com/javatechonline/quiz/GuessTheOutPut.class deleted file mode 100644 index a2b1639..0000000 Binary files a/bin/com/javatechonline/quiz/GuessTheOutPut.class and /dev/null differ diff --git a/bin/com/pattern/Airtel.class b/bin/com/pattern/Airtel.class deleted file mode 100644 index 28403af..0000000 Binary files a/bin/com/pattern/Airtel.class and /dev/null differ diff --git a/bin/com/pattern/Customer.class b/bin/com/pattern/Customer.class deleted file mode 100644 index 08938d1..0000000 Binary files a/bin/com/pattern/Customer.class and /dev/null differ diff --git a/bin/com/pattern/Jio.class b/bin/com/pattern/Jio.class deleted file mode 100644 index ba1799e..0000000 Binary files a/bin/com/pattern/Jio.class and /dev/null differ diff --git a/bin/com/pattern/Telecom.class b/bin/com/pattern/Telecom.class deleted file mode 100644 index 3c85bcb..0000000 Binary files a/bin/com/pattern/Telecom.class and /dev/null differ diff --git a/bin/com/predicates/Predicates.class b/bin/com/predicates/Predicates.class deleted file mode 100644 index 1355eb0..0000000 Binary files a/bin/com/predicates/Predicates.class and /dev/null differ diff --git a/bin/com/reflection/Emp$A.class b/bin/com/reflection/Emp$A.class deleted file mode 100644 index 18e2f7d..0000000 Binary files a/bin/com/reflection/Emp$A.class and /dev/null differ diff --git a/bin/com/reflection/Emp$B.class b/bin/com/reflection/Emp$B.class deleted file mode 100644 index 718ae28..0000000 Binary files a/bin/com/reflection/Emp$B.class and /dev/null differ diff --git a/bin/com/reflection/Emp$MyAnno.class b/bin/com/reflection/Emp$MyAnno.class deleted file mode 100644 index 3571ec1..0000000 Binary files a/bin/com/reflection/Emp$MyAnno.class and /dev/null differ diff --git a/bin/com/reflection/Emp$Week.class b/bin/com/reflection/Emp$Week.class deleted file mode 100644 index 4624829..0000000 Binary files a/bin/com/reflection/Emp$Week.class and /dev/null differ diff --git a/bin/com/reflection/Emp.class b/bin/com/reflection/Emp.class deleted file mode 100644 index 756924a..0000000 Binary files a/bin/com/reflection/Emp.class and /dev/null differ diff --git a/bin/com/reflection/ReflectionExample.class b/bin/com/reflection/ReflectionExample.class deleted file mode 100644 index 1ccaad4..0000000 Binary files a/bin/com/reflection/ReflectionExample.class and /dev/null differ diff --git a/bin/com/strings/methods/StringTest.class b/bin/com/strings/methods/StringTest.class deleted file mode 100644 index 5b9c359..0000000 Binary files a/bin/com/strings/methods/StringTest.class and /dev/null differ diff --git a/bin/com/thread/Consumer.class b/bin/com/thread/Consumer.class deleted file mode 100644 index 8ce1667..0000000 Binary files a/bin/com/thread/Consumer.class and /dev/null differ diff --git a/bin/com/thread/MyRunnable.class b/bin/com/thread/MyRunnable.class deleted file mode 100644 index 4502e6b..0000000 Binary files a/bin/com/thread/MyRunnable.class and /dev/null differ diff --git a/bin/com/thread/MyThread.class b/bin/com/thread/MyThread.class deleted file mode 100644 index d335222..0000000 Binary files a/bin/com/thread/MyThread.class and /dev/null differ diff --git a/bin/com/thread/Producer.class b/bin/com/thread/Producer.class deleted file mode 100644 index 65000c9..0000000 Binary files a/bin/com/thread/Producer.class and /dev/null differ diff --git a/bin/com/thread/SleepYieldExample.class b/bin/com/thread/SleepYieldExample.class deleted file mode 100644 index d37dcbd..0000000 Binary files a/bin/com/thread/SleepYieldExample.class and /dev/null differ diff --git a/bin/com/thread/ThreadUsingRunnable.class b/bin/com/thread/ThreadUsingRunnable.class deleted file mode 100644 index b8c233a..0000000 Binary files a/bin/com/thread/ThreadUsingRunnable.class and /dev/null differ diff --git a/bin/com/thread/ThreadUsingThreadClass.class b/bin/com/thread/ThreadUsingThreadClass.class deleted file mode 100644 index 860f7b8..0000000 Binary files a/bin/com/thread/ThreadUsingThreadClass.class and /dev/null differ diff --git a/bin/com/thread/VolatileData.class b/bin/com/thread/VolatileData.class deleted file mode 100644 index 1f2a508..0000000 Binary files a/bin/com/thread/VolatileData.class and /dev/null differ diff --git a/bin/com/thread/VolatileMain.class b/bin/com/thread/VolatileMain.class deleted file mode 100644 index b6a115b..0000000 Binary files a/bin/com/thread/VolatileMain.class and /dev/null differ diff --git a/bin/com/thread/VolatileThread.class b/bin/com/thread/VolatileThread.class deleted file mode 100644 index c91431c..0000000 Binary files a/bin/com/thread/VolatileThread.class and /dev/null differ diff --git a/bin/com/thread/YieldExample.class b/bin/com/thread/YieldExample.class deleted file mode 100644 index 6fc15a6..0000000 Binary files a/bin/com/thread/YieldExample.class and /dev/null differ diff --git a/bin/com/thread/YieldThreadDemo.class b/bin/com/thread/YieldThreadDemo.class deleted file mode 100644 index 4798c9c..0000000 Binary files a/bin/com/thread/YieldThreadDemo.class and /dev/null differ diff --git a/bin/com/wrapper/classes/CharacterExample.class b/bin/com/wrapper/classes/CharacterExample.class deleted file mode 100644 index 89217f6..0000000 Binary files a/bin/com/wrapper/classes/CharacterExample.class and /dev/null differ diff --git a/questions/AWS.txt b/questions/AWS.txt new file mode 100644 index 0000000..7906084 --- /dev/null +++ b/questions/AWS.txt @@ -0,0 +1,128 @@ + +AWS : + +1.✅ Whay is Elastic Bean Stack ? +Ans : +AWS Elastic Beanstalk is a Platform as a Service (PaaS) offered by Amazon Web Services that lets you deploy and manage web applications easily without worrying about the infrastructure. +🔹 Key Features +| Feature | Description | +| ------------------------------- | ----------------------------------------------------------------------- | +| **Managed environment** | AWS handles provisioning, load balancing, auto-scaling, and monitoring. | +| **Supports multiple languages** | Java, Python, Node.js, .NET, PHP, Ruby, Go, and Docker. | +| **Integrated with CI/CD** | Works well with GitHub, CodePipeline, etc. | +| **Auto-scaling** | Automatically scales up/down based on load. | +| **Monitoring** | Integrated with CloudWatch for logs and metrics. | + +🔹 How It Works +You upload your application (WAR, JAR, ZIP, or Docker). +Elastic Beanstalk creates environment: +EC2 instance(s) +Load balancer +Auto Scaling Group +RDS (optional) +AWS manages the deployment, updates, scaling, and health monitoring. + +Q2. What is EC2 in AWS? +Q3. What is Lambda in AWS ? +Ans : +AWS Lambda is a serverless compute service where you write a small piece of code (called a "function") and AWS runs it on-demand without provisioning or managing servers. + +✅ Key Features: +No server management +Scales automatically +Billed only for the execution time +Event-driven: triggers include S3, DynamoDB, API Gateway, SNS, etc. +📌 Example Use Case: +Upload image to S3 ➡️ Trigger Lambda ➡️ Resize image ➡️ Store resized image in another S3 bucket + +Q4. ✅What is S3 Storage in AWS ? +Q5. ✅What is CloudWatch in AWS ? +Ans : +Amazon CloudWatch is a monitoring and observability service provided by AWS that helps you collect, view, and analyze metrics, logs, and events from your AWS infrastructure, applications, and services in real time. +🔹 Key Features of CloudWatch +| Feature | Description | +| ----------------------- | -------------------------------------------------------------------------- | +| **Metrics** | Collect performance metrics (e.g., CPU, memory, disk, custom app metrics). | +| **Logs** | Centralized logging from AWS services and custom applications. | +| **Alarms** | Notify you when a metric crosses a threshold (e.g., high CPU, low disk). | +| **Dashboards** | Create custom visualizations and monitoring dashboards. | +| **Events** | Respond to events (e.g., instance start/stop) using rules and Lambda. | +| **CloudWatch Insights** | Run queries on log data for analysis and debugging. | +🔧 Example: Create a CloudWatch Alarm for EC2 CPU > 80% +Go to EC2 → Monitoring → Create Alarm. +Set the condition: CPUUtilization > 80 for 5 minutes. +Set actions: send notification via SNS topic. +Save the alarm — CloudWatch will now monitor and notify you. + +Q6. ✅What is ESC in AWS ? +Q7. ✅What is API Gateway in AWS ? +Q8. ✅What is Security Group in AWS ? +Ans : +A Security Group (SG) in AWS acts as a virtual firewall that controls inbound and outbound traffic to your EC2 instances +(or other AWS resources like RDS, Lambda in VPC, etc.). +🔐 Key Points: +Security groups are stateful: +If you allow inbound traffic, the corresponding outbound response is automatically allowed. +They control traffic at the instance level, not the subnet level. +Security groups only allow traffic (they do not deny — anything not explicitly allowed is denied). +🔸 Example: +You launch a web server on EC2 and want to: +| Direction | Rule | Purpose | +| --------- | ------------------------------------------ | -------------------------------------- | +| Inbound | Allow TCP on port 80 (HTTP) from 0.0.0.0/0 | Allow public web traffic | +| Inbound | Allow TCP on port 22 (SSH) from your IP | Allow secure remote access | +| Outbound | Allow all traffic | Default to let EC2 access internet/API | +🔧 Sample Security Group Rule: +| Type | Protocol | Port Range | Source | +| ------ | -------- | ---------- | ------------------------ | +| HTTP | TCP | 80 | 0.0.0.0/0 | +| SSH | TCP | 22 | 203.0.113.0/32 | +| Custom | TCP | 8080 | sg-xxxxxxxx (another SG) | +🔄 Security Group vs NACL (Network ACL) +| Feature | Security Group | Network ACL | +| ---------- | --------------------------------- | --------------------------------- | +| Level | Instance-level | Subnet-level | +| Stateful | ✅ Yes | ❌ No (must allow both directions) | +| Rules | Only **allow** | Allow or deny | +| Applied to | ENIs (Elastic Network Interfaces) | Subnets + +📌 Best Practices: +Keep SSH ports restricted to known IPs. +Separate public and private SGs (e.g., one for web, one for DB). +Use SG referencing for service-to-service communication. + +✅ Example: Assign SG to EC2 +When launching an EC2 instance: +Go to Configure Security Group step. +.Add rules (e.g., HTTP, HTTPS, SSH). +Assign the SG — either create new or reuse existing. | + +Q9. ✅What is RDS in AWS ? +Q10.✅ What is VPC in AWS ? +Q11.❓ What is Subnet in AWS ? +Ans : +In AWS (Amazon Web Services), a subnet is a range of IP addresses within a VPC (Virtual Private Cloud). It allows you to logically separate and organize your resources within a network. +A subnet (short for sub-network) is a segment of a larger network (VPC) where you can place AWS resources such as EC2 instances, databases, and load balancers. +🛠️ Types of Subnets in AWS: +| Type | Description | +| ------------------ | ------------------------------------------------------ | +| **Public Subnet** | Connected to the internet via an **Internet Gateway**. | +| **Private Subnet** | No direct internet access. Used for backend systems. | + +📌 Example Scenario: +Imagine you have a VPC with CIDR block 10.0.0.0/16. +You can divide it into subnets: +10.0.1.0/24 → Public Subnet +10.0.2.0/24 → Private Subnet + +🛡️ Why Use Subnets? +To separate frontend/backend layers +To secure resources (private subnets = no internet) +To control network routing +For high availability (across multiple Availability Zones) + +🔧 How to Create a Subnet in AWS? +Go to VPC Dashboard +Click Subnets → Create Subnet +Choose your VPC, availability zone, and CIDR block (e.g., 10.0.1.0/24) +Optionally associate a route table and security group diff --git a/questions/Git.txt b/questions/Git.txt new file mode 100644 index 0000000..15b0d35 --- /dev/null +++ b/questions/Git.txt @@ -0,0 +1,26 @@ +echo "# dev-configuration-service" >> README.md +git init +git add README.md +git commit -m "first commit" +git branch -M main +git remote add origin https://github.com/devsus/dev-configuration-service.git +git push -u origin main + + +…or push an existing repository from the command line +git remote add origin https://github.com/devsus/dev-configuration-service.git +git branch -M main +git push -u origin main + + + + +===========================KAFKA=========================================== +1. Producer : It is producing messages contineously . +2. Kafka Broker : The Broker is Kafka Server, Its just a meaning full name given to the kafka server, + And this name make sence as well because all that kafka dose it act as a massage broker between producer and consumer. + The Producer and consumer dont interact directly, They use KAFKA Server as an agent or broker to exchange messages. +2. Consumer : It is consuming data from producer . +3. Topic : Topic is like a table in database or folder in a file system, Topic is identified by name, you can have any number of topic . +4. Partition: +5. Offset : \ No newline at end of file diff --git a/questions/Interview 2025.txt b/questions/Interview 2025.txt new file mode 100644 index 0000000..548d70d --- /dev/null +++ b/questions/Interview 2025.txt @@ -0,0 +1,8029 @@ +🔁 HashMap Collision Handling – Simple Visualization. +Let's say we are inserting these 3 keys: +Key1 = "Aa" // hashCode() → 2037 +Key2 = "BB" // hashCode() → 2037 (Collision!) +Key3 = "Cc" // hashCode() → 999 +📦 Step 1: Hashing to Bucket +HashMap stores keys in buckets, based on this formula: +bucketIndex = hashCode(key) % totalBuckets + +Let’s assume we have 16 buckets (indexes 0–15): + +"Aa" → 2037 % 16 = 5 → Goes to Bucket 5 +"BB" → 2037 % 16 = 5 → Goes to Bucket 5 (Collision!) +"Cc" → 999 % 16 = 7 → Goes to Bucket 7 +🪣 Buckets after insert: +Bucket 5 → [Node("Aa"), Node("BB")] <-- Collision resolved via Linked List or Tree [If colision is exceed in same bucket managed Red Black Tree] +Bucket 7 → [Node("Cc")] + +🔍 Retrieval Process: map.get("BB") +1. Calculate hash bucket: "BB" → 2037 → bucket index = 5 + +2. Go to Bucket 5: Find linked nodes there → [Node("Aa"), Node("BB")] + +3. Compare keys: +First checks "BB".equals("Aa") → ❌ No +Then checks "BB".equals("BB") → ✅ Yes → Return value +✅ Summary Table: Collision Avoidance & Resolution +| Concept | Role in Collision Handling | +| ------------------------- | ----------------------------------------------------- | +| `hashCode()` | Assigns key to a bucket | +| Buckets (Array Slots) | Each slot holds entries, collisions go to same bucket | +| `.equals()` | Used when multiple entries exist in same bucket | +| LinkedList/Tree in Bucket | Stores multiple entries (same hash but not equal) | +| Resize (Rehashing) | Reduces future collisions if too many entries | +💡 Key Points +Same hashCode → Same bucket. +Different objects → Checked via .equals() within bucket. +Collisions are common → Handled by chaining (list/tree). +equals() is crucial in differentiating keys with same hash. + +👀 Want to See Live? +Here’s a working Java snippet to demonstrate this: +Map map = new HashMap<>(); + +String k1 = "Aa"; // hashCode = 2037 +String k2 = "BB"; // hashCode = 2037 → same as "Aa" + +map.put(k1, "Value1"); +map.put(k2, "Value2"); + +System.out.println("k1 equals k2? " + k1.equals(k2)); // false +System.out.println("HashCodes: " + k1.hashCode() + ", " + k2.hashCode()); // same +System.out.println("Get k1: " + map.get(k1)); // Value1 +System.out.println("Get k2: " + map.get(k2)); // Value2 + +----------------------------------Cognizant--------------------------------- +Q. What is maven life cycle ? +Ans : +Maven has 3 built-in lifecycles, but the most used one is: +default (main): Handles the actual build (compilation → packaging → install) +clean : Cleans the target directory (removes compiled files) +site : Generates documentation for the project + +| Phase | What it Does | +| ---------- | --------------------------------------------------- | +| `validate` | Validate the project and its dependencies | +| `compile` | Compile the source code | +| `test` | Run unit tests using a test framework (e.g., JUnit) | +| `package` | Package the compiled code into a JAR/WAR | +| `verify` | Run checks on the package (integration tests, etc.) | +| `install` | Install the JAR/WAR to the local Maven repository | +| `deploy` | Deploy the package to a remote repo (CI/CD) | + +=====> mvn clean install +This runs: + +1. clean → Deletes target/ + +2. validate + +3. compile + +4. test + +5. package + +6. install + +Maven automatically runs all previous phases before the one you specify. + +| Command | Description | +| ------------- | --------------------------------- | +| `mvn compile` | Compile source code | +| `mvn test` | Run tests | +| `mvn package` | Create JAR/WAR file | +| `mvn install` | Install to local `.m2` repository | +| `mvn deploy` | Push to remote Maven repo | +| `mvn clean` | Remove `target/` folder | + + +Q1. mvn clean install vs mvn clean compile? +Ans : +✅ mvn clean compile +What it does: +clean – Deletes the target/ directory (removes previous builds). +compile – Compiles the source code (src/main/java) into .class files. + +🔧 Use case: +When you just want to compile the source code to check for compilation errors. + +No testing, packaging, or installation into local repository. + +✅ mvn clean install +What it does: +clean – Deletes target/ directory. + +install – Runs entire build lifecycle: + +validate → compile → test → package → verify → install + +Compiles, runs unit tests, packages into a JAR/WAR, and installs it into your local .m2 repository. + +🏗 Use case: +| Command | Does This | Use When You Want To... | +| ------------------- | ------------------------------------------ | ------------------------------------------------ | +| `mvn clean compile` | Clean + Compile | Check for compilation errors | +| `mvn clean install` | Clean + Compile + Test + Package + Install | Build and install the artifact locally for reuse | +=========================================================================================== +Q2. What is actuators and urls ? +Ans :Spring Boot Actuator is a subproject of Spring Boot that helps you monitor and manage your application in production. It exposes various endpoints (URLs) to ->get runtime information such as: +->Health of the application +->Metrics (memory, CPU, threads) +->Beans, environment, configs +->HTTP traces, loggers, and more +Common Actuator URLs (Endpoints) +After adding Actuator to your project (spring-boot-starter-actuator), the following endpoints become available: +| Endpoint URL | Description | +| ---------------------- | ----------------------------------------------------- | +| `/actuator` | Lists all available actuator endpoints | +| `/actuator/health` | Shows application health status | +| `/actuator/metrics` | Shows metrics (CPU, memory, GC, etc.) | +| `/actuator/info` | Custom build/app info (from `application.properties`) | +| `/actuator/beans` | Shows all Spring beans | +| `/actuator/env` | Displays environment variables | +| `/actuator/loggers` | Shows log levels and allows changing them dynamically | +| `/actuator/threaddump` | Shows thread dump | +| `/actuator/httptrace` | Shows last HTTP requests (disabled by default) | +Configure URLs in application.properties: +#Enable all endpoints +management.endpoints.web.exposure.include=* +#Change base path if needed +management.endpoints.web.base-path=/actuator + +================================================================================================ +Q3. Find output ? + String str = "hello"; + String str1 = new String("hello"); + str=str1; + str.equals(str2) // true //.equals() comparing only content not object +================================================================================================ +Q4. how to hide property file value in production? using configure server we can secure the data in spring boot ? +Ans : +🔒 1. Use Environment Variables (Best Practice for Production) +# application.properties +db.password=${DB_PASSWORD} +🧳 2. Use External Configuration File (Outside JAR) +Keep sensitive application-prod.properties file outside your JAR, like +/home/user/config/application-prod.properties +Run the Spring Boot application with: +java -jar your-app.jar --spring.config.location=/home/user/config/ +🔐 3. Use Encrypted Values with Jasypt +================================================================================================ +Q5. Group Student List by rank ? + +Ans1: Map> grpStdByRank = list.stream().collect(Collectors.groupingBy(Student::getRank)); +Ans2: Map> result = list.stream().collect(Collectors.groupingBy(Student::getRank,Collectors.mapping(Student::getName(),Collectors.toList()))); +================================================================================================== +Q6. Find student name start with A +Ans : List startWithA = list.stream().filter(s->s.getName().startWith("A")).collect(Collectors.toList()); +================================================================================================= +Q7.How Optimize SQL Query ? +Ans: +🔍 1. Use EXPLAIN or QUERY PLAN +EXPLAIN SELECT * FROM employees WHERE department_id = 10; [EXPLAIN is a keyword here of mysql] +🔢 2. Use Indexes Wisely +CREATE INDEX idx_employee_dept ON employees(department_id); +✂️ 3. SELECT Only Required Columns +-- ❌ Bad +SELECT * FROM employees; +-- ✅ Good +SELECT name, email FROM employees; +🔎 4. Avoid Functions in WHERE Clause +-- ❌ Bad +WHERE YEAR(created_at) = 2024 +-- ✅ Good +WHERE created_at >= '2024-01-01' AND created_at < '2025-01-01' +🔄 5. Avoid NOT IN, Prefer NOT EXISTS +-- ❌ Slower +SELECT name FROM employees WHERE id NOT IN (SELECT emp_id FROM payroll); + +-- ✅ Better +SELECT name FROM employees WHERE NOT EXISTS ( + SELECT 1 FROM payroll WHERE payroll.emp_id = employees.id +); +🧠 6. Use JOIN Instead of Subqueries (In Some Cases) +-- ❌ Subquery +SELECT name FROM employees WHERE department_id IN (SELECT id FROM departments WHERE location = 'NY'); + +-- ✅ Better +SELECT e.name +FROM employees e +JOIN departments d ON e.department_id = d.id +WHERE d.location = 'NY'; +🔄 7. Use LIMIT or TOP for Pagination +-- ✅ Good for pagination +SELECT * FROM employees ORDER BY id LIMIT 50 OFFSET 0; +🧮 8. Use CASE Instead of Multiple Queries +🔀 9. Batch Inserts/Updates +INSERT INTO users (id, name) VALUES (1, 'A'); +INSERT INTO users (id, name) VALUES (2, 'B'); +Do: +INSERT INTO users (id, name) VALUES +(1, 'A'), +(2, 'B'); +📊 10. Keep Stats and Analyze Tables +ANALYZE TABLE employees; + +================================================================================================ +Q8.How maintain git confliction ? +Ans : 1. Trigger a Conflict (example) +git checkout dev +git merge feature-branch + +2. Open the Conflict File +<<<<<<< HEAD +int x = 5; +======= +int x = 10; +>>>>>>> feature-branch +3. Manually Resolve the Conflict +Remove all <<<<<<<, =======, and >>>>>>> lines. + +================================================================================================ +Q9.git pull vs git fetch ? +Ans : + git pull fetches new changes from the remote and automatically merges them into your current branch. + git fetch downloads new changes from the remote repository but does NOT merge them into your local branch. + +Q10. how to secure spring boot application.properties on deployment ? +Ans : +🔒 1. Don’t hardcode secrets in application.properties +Avoid writing: +spring.datasource.password=mydbpassword +jwt.secret=abcd1234 +Instead, externalize secrets. +🔑 2. Use Environment Variables +Replace sensitive values with placeholders: +spring.datasource.username=${DB_USER} +spring.datasource.password=${DB_PASS} +jwt.secret=${JWT_SECRET} +Then set them in environment before running: +export DB_USER=myuser +export DB_PASS=supersecret +export JWT_SECRET=verySecretKey +Works well with Docker, Kubernetes, and cloud platforms. +🔐 3. Use Spring Cloud Config + Vault +Spring Cloud Config Server can load properties from a secure Git repo (private, encrypted). +HashiCorp Vault or AWS Secrets Manager / Azure Key Vault can store secrets securely. + +Example: Spring Boot integrates with Vault via starter: + + org.springframework.cloud + spring-cloud-starter-vault-config + +🔑 4. Encrypt Sensitive Properties +Spring Boot supports Jasypt or Spring Cloud Config’s encryption: +Example with Jasypt: +spring.datasource.password=ENC(ENCRYPTED_STRING) +Then configure decryption key via environment variable. +🔑 6. Profiles for Different Environments +Keep different property files: +application-dev.properties (for local dev) +application-prod.properties (production, loaded from env/secret manager) + +Activate profiles via: +java -jar app.jar --spring.profiles.active=prod +*******************************Capgemini************************************ +Q.11 +Input : apple avocado , banana, blue berry , cherry +Output : +A = apple, avocado +B = banana, blue berry +Ans : +List fruits =Arrays.asList("apple", "avocado" , "banana", "blue", "berry" , "cherry"); + // Group fruits by their starting letter + Map> groupedFruits = fruits.stream().collect(Collectors.groupingBy(fruit -> Character.toUpperCase(fruit.charAt(0)))); + + // Format and print the result + groupedFruits.forEach((letter, fruitList) -> { + String fruitsString = String.join(", ", fruitList); + System.out.println(letter + " = " + fruitsString); + }); +=================================================================================================== +Q11. What is fault tolerance in microservice ? +Ans : +Fault tolerance is the ability of a microservice-based system to continue functioning even when one or more services fail. + +🔧 Why is it Important? +In microservices, different services are independently deployed and communicate over the network. Failures are inevitable—due to network latency, crashes, timeouts, or external system errors. Fault tolerance ensures: +The entire system doesn’t crash due to a single service failure. +Users get graceful fallbacks or retries instead of error pages. +✅ Fault Tolerance Mechanisms: +| Technique | Description | Example | +| ------------------- | ------------------------------------------------------------ | ------------------------------------------------------ | +| **Retry** | Automatically retry a failed request | Retry 3 times if a service is slow | +| **Timeout** | Limit waiting time for a service response | Fail after 2 seconds | +| **Circuit Breaker** | Prevent repeated calls to a failing service | Opens circuit after 5 failures | +| **Bulkhead** | Isolate service threads/resources to avoid system-wide crash | Each service has separate thread pool | +| **Fallback** | Provide default behavior or cached data if a service fails | Show cached product details if product service is down | +| **Rate Limiting** | Prevent system overload by limiting request rate | Allow 100 requests/sec per service | +===================================================================================================== +Q12. can declare constructor final ? +Ans: No , If we declare it final then we can not reinitialize it. +===================================================================================================== +Q13. Can call one constructor to another constructor ? Yes +Ans : +public class Student { + private String name; + private int age; + + public Student() { + this("Default Name", 18); // calls parameterized constructor + System.out.println("Default constructor"); + } + + public Student(String name, int age) { + this.name = name; + this.age = age; + System.out.println("Parameterized constructor"); + } +} +============================================================================================= +Q14. Can we use this key word in super constructor ? +Ans: No +============================================================================================= +Q15. can we override static method ? +Ans : No ➡️ This is called method hiding, not overriding. +🔍 Why? +Because: +Static methods belong to the class, not the instance (object). +Overriding is an object-oriented (runtime polymorphism) feature. +Static methods are resolved at compile-time (early binding), not at runtime. +class Parent { + static void show() { + System.out.println("Parent static show()"); + } +} + +class Child extends Parent { + static void show() { + System.out.println("Child static show()"); + } +} +public class Test { + public static void main(String[] args) { + Parent p = new Child(); + p.show(); // Output: Parent static show() + } +} + +============================================================================================= +Q16. What is circular dependency in spring? +Ans : +A circular dependency occurs when two or more classes (or beans) depend on each other directly or indirectly, creating a loop. +Problem : +@Component +public class A { + @Autowired + private B b; +} + +@Component +public class B { + @Autowired + private A a; +} +Soution : +@Component +public class A { + @Autowired + @Lazy + private B b; +} + +@Component +public class B { + @Autowired + private A a; +} +We can use constructor in above +============================================================================================= +Q17. What is Microservice Architecture design pattern ? +Ans : +A Microservice Design Pattern is a proven solution to common problems encountered when designing, building, or deploying microservice architectures. These patterns help ensure scalability, maintainability, fault tolerance, and performance of distributed systems. + +🧱 Common Microservice Design Patterns +1. Decomposition Patterns +Split the monolith into microservices. +By Business Capability – Divide services by domain (e.g., User, Order, Payment). +By Subdomain – Based on Domain-Driven Design (DDD). + +2. API Gateway Pattern +A single entry point for all clients that routes requests to internal services. +Tools : A. Spring Cloud Gateway (Most Common in Spring Boot) + Built on Spring WebFlux (Reactor Netty) → supports reactive, async requests. + Provides routing + filters + security integration. + Very easy with Spring Boot. + B. Netflix Zuul (Older, Legacy Option) + Synchronous, built on Servlet stack. + Now replaced by Spring Cloud Gateway. + Still usable in legacy systems. + C. API Management Solutions (Kong, Apigee, AWS API Gateway, Azure API Management) + Enterprise-grade API gateways with rate limiting, analytics, OAuth2/JWT, monetization. + Suitable when deploying on cloud platforms. + ⚡ Typical API Gateway Responsibilities + + Routing (student-service, course-service, etc.) + Authentication & Authorization (JWT, OAuth2) + SSL termination (HTTPS → HTTP internal calls) + Rate limiting, throttling + Logging & tracing (Spring Sleuth + Zipkin/ELK) + Circuit breaking (with Resilience4j/Hystrix) +✔ Benefits: +Centralized authentication, logging, rate limiting. +Aggregates multiple services into one response. + +3. Database per Service Pattern +Each service has its own database to maintain loose coupling. +⚠️ Requires handling distributed transactions. + +4. Circuit Breaker Pattern +Stops calling a failing service temporarily to prevent cascading failures. +🛠️ Tools: Resilience4j, Hystrix + +5. Service Discovery Pattern +Automatically find and connect to services dynamically. +🛠️ Tools: Netflix Eureka, Consul + +6. Strangler Pattern +Gradually replace legacy systems by building new features as microservices. + +7. CQRS (Command Query Responsibility Segregation) +Separate read and write operations into different models. +✔ Improves performance, scalability, and security. + +8. Event Sourcing Pattern +Store state changes as a sequence of events instead of the current state. +✔ Works well with CQRS. + +9. Saga Pattern +Manage distributed transactions through a sequence of local transactions and compensating actions. +✔ Used when there’s no distributed ACID transaction support. + +10. Bulkhead Pattern +Isolate resources (like threads or DB connections) between services to avoid system-wide failures. +==================================================================================================== +Q18. How to optimize Rest API ? +Ans : Sorting,Pagignation, Cache @Cacheable("users"), Rate limit , @Async +======================================================================================================= +Q19. What is N+1 Query Problem ? +Ans: The N+1 Query Problem occurs when your application performs 1 query to fetch the main entity and then N additional queries to fetch related entities — one for each result in the main entity list. This leads to excessive DB hits and poor performance. +Example :Suppose you have: +@Entity +class Department { + @OneToMany(mappedBy = "department") + private List employees; +} + +@Entity +class Employee { + @ManyToOne + private Department department; +} +And you run: +List depts = em.createQuery("SELECT d FROM Department d", Department.class).getResultList(); +for (Department d : depts) { + System.out.println(d.getEmployees().size()); +} +❗ What's happening behind the scenes: +🔁 1 query to fetch all departments: +SELECT * FROM department; +🔁 N queries to fetch employees for each department: +SELECT * FROM employee WHERE department_id = ?; +➡️ If there are 100 departments, you run 1 + 100 = 101 queries! + +🚀 Solution 1: JOIN FETCH +Use JPQL with JOIN FETCH to load data in a single query: +List depts = em.createQuery( + "SELECT d FROM Department d JOIN FETCH d.employees", Department.class) +.getResultList(); + +🚀 Solution 2: Use @EntityGraph in Spring Data JPA +@EntityGraph(attributePaths = "employees") +List findAll(); +========================================================================================================== +Q20. Stereo type annotations ? +Ans : @Service,@Repository,@Component ,@Controller, @RestController +========================================================================================================== +Q21. Controller v/s RestController +Ans : +🔹 @Controller: Used in traditional MVC applications,Returns views (HTML, JSP),If you return a value, it’s treated as a view name,To return JSON, you mustexplicitly use @ResponseBody. +🔹 @RestController: Introduced in Spring 4.Shortcut for @Controller + @ResponseBody.Used in RESTful APIs.All returned values are converted to JSON or XML automatically. +======================================================================================================= +Q22. How to secure Rest APIS ? +Ans : Using Spring Security +🔐 1. Use HTTPS +Always serve your API over HTTPS to encrypt data in transit. +This prevents man-in-the-middle (MITM) attacks +🔑 2. Authentication +| Method | Description | +| ------------------------ | ----------------------------------------------- | +| **Basic Auth** | Simple (not recommended for production). | +| **JWT** (JSON Web Token) | Popular, stateless token-based system. | +| **OAuth2** | For third-party access & authorization. | +| **API Keys** | Lightweight, but less secure than JWT or OAuth. | +🛂 3. Authorization +Decide what authenticated users can access. +Use roles (like ROLE_ADMIN, ROLE_USER) to restrict endpoints. +🧱 4. Spring Security Configuration Example +@Configuration +@EnableWebSecurity +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Override + protected void configure(HttpSecurity http) throws Exception { + http + .csrf().disable() + .authorizeRequests() + .antMatchers("/api/public/**").permitAll() + .antMatchers("/api/admin/**").hasRole("ADMIN") + .anyRequest().authenticated() + .and() + .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS) + .and() + .addFilter(new JwtAuthenticationFilter(authenticationManager())); + } +} +🔍 5. Input Validation & Escaping +Sanitize inputs to avoid SQL Injection and XSS. +Use Hibernate Validator or Spring's @Valid. +🧊 6. Rate Limiting +Prevent abuse or brute-force attacks. +Use Spring Cloud Gateway or external tools (like NGINX). +🔒 7. CORS Configuration +Enable only trusted domains to access the API. +@Bean +public WebMvcConfigurer corsConfigurer() { + return new WebMvcConfigurer() { + @Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/api/**").allowedOrigins("https://your-client.com"); + } + }; +} + +======================================================================================================== +Q23. Fail Fast v/s Fail safe +Ans : +🔹 Fail-Fast: Throws ConcurrentModificationException if the collection is modified while iterating (except via iterator's own methods).Doesn't guarantee iteration after modification.Not thread-safe. +Example: ArrayLis,HashMap,HashSet +🔹 Fail-Safe: Does NOT throw ConcurrentModificationException if collection is modified during iteration.Iterates over a clone or snapshot of the collection. +Thread-safe but may have stale data. +Examples:CopyOnWriteArrayList,ConcurrentHashMap. +========================================================================================================= +Q24. Internal working of HashMap +Ans: +=========================================================================================================== +Q25. TreeMap v/s HashMap +Ans:Both TreeMap and HashMap are part of the Java Map interface, but they have key differences in ordering, performance, and internal implementation. +| Feature | **HashMap** | **TreeMap** | +| ----------------------------------- | ----------------------------------------------- | --------------------------------------------------------- | +| ✅ **Ordering** | No guaranteed order (random) | Keys sorted in **natural** or **custom Comparator** order | +| 🧠 **Underlying Data Structure** | Hash Table | Red-Black Tree (Self-balancing BST) | +| ⚡ **Performance (Time Complexity)** | O(1) for `get()`, `put()` in average case | O(log n) for `get()`, `put()` | +| 🧩 **Allows Null Key?** | Yes (only one `null` key allowed) | ❌ No null key allowed (throws `NullPointerException`) | +| 📌 **Key Sorting** | No sorting | Sorted automatically | +| 🔄 **Iteration Order** | Unpredictable | Sorted by key | +| 🧱 **Thread Safety** | Not thread-safe | Not thread-safe | +| 📦 **Use Case** | When **fast access** with no ordering is needed | When **sorted data** is required | + +=========================================================================================================== +Q26. Why TreeMap is not allow null key ? +Ans : TreeMap does not allow null keys because it uses natural ordering (via Comparable) or a custom Comparator to sort keys. +=========================================================================================================== +Q27. Intermediate v/s Terminal operation? +Ans: +🔁 1. Intermediate Operations +| Feature | Description | +| ----------------------- | -------------------------------------------------------------------------------------------- | +| 🔄 **Lazy Evaluation** | Do **not execute immediately**; they’re evaluated only when a terminal operation is invoked. | +| 🔗 **Returns a Stream** | Allows chaining multiple operations. | +| ❌ **No final result** | Only builds the pipeline. +✅ Examples: | +.stream().filter() +.stream().map() +.stream().sorted() +.stream().distinct() +.stream().limit() +🔚 2. Terminal Operations +| Feature | Description | +| ----------------------------- | --------------------------------------------------- | +| 🧠 **Triggers Execution** | Actually **executes the stream pipeline**. | +| 📦 **Returns a final result** | A value, collection, or nothing (like void). | +| 🚫 **Consumes the Stream** | Stream cannot be reused after a terminal operation. | +✅ Examples: +.forEach() +.collect() +.reduce() +.count() +.min() / .max() +.anyMatch(), allMatch(), noneMatch() +=========================================================================================================== +Q28. what is Volatile Key word ? +Ans : The volatile keyword in Java is used to ensure visibility and ordering of variables across multiple threads. It's mainly used for variables that are shared between threads. +✅ Definition +volatile is a modifier in Java that can be applied to instance variables (not classes, methods, or local variables). +It tells the JVM and threads that: +This variable’s value will be modified by multiple threads. + +Always read the latest value of the variable directly from main memory, not from a thread’s local cache. +| Keyword | Visibility | Atomicity | Locking | +| -------------- | ---------- | --------- | ---------------| +| `volatile` | ✅ Yes | ❌ No | ❌ No Lock | +| `synchronized` | ✅ Yes | ✅ Yes | ✅ Has Lock | +Example : + class SharedData { + boolean flag = false; + + public void writer() { + flag = true; // update done by Thread-1 + } + + public void reader() { + while (!flag) { + // Thread-2 may never see the updated value, + // because flag might be cached in CPU cache. + } + System.out.println("Flag changed!"); + } +} +👉 Here, Thread-2 may never exit the loop, because flag could stay cached locally and never see the update from Thread-1. +✅ With volatile +class SharedData { + volatile boolean flag = false; + + public void writer() { + flag = true; + } + + public void reader() { + while (!flag) { + // Now Thread-2 will see the change made by Thread-1 + } + System.out.println("Flag changed!"); + } +} +👉 Because of volatile, Thread-2 always reads the latest value from main memory, so it will exit the loop when flag = true. +✅ What volatile Guarantees +Visibility: Changes made by one thread are visible to others immediately. +Ordering (happens-before relationship) +Read/write of a volatile variable cannot be reordered with respect to other volatile reads/writes. +======================================================================================================== +Q29. what is Transient Key word ? +Ans: The transient keyword is used in Java to exclude a field from serialization. When an object is serialized, transient fields are not saved to the byte stream. +========================================================================================================== +Q30. How to handel Global Exception in Spring boot? +Ans:✅ Ways to Handle Global Exceptions in Spring Boot +1. Using @ControllerAdvice and @ExceptionHandler +package com.example.demo.exception; + +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; + +@ControllerAdvice // Global exception handler +public class GlobalExceptionHandler { + + // Handle specific exception + @ExceptionHandler(ResourceNotFoundException.class) + public ResponseEntity handleResourceNotFound(ResourceNotFoundException ex) { + return new ResponseEntity<>(ex.getMessage(), HttpStatus.NOT_FOUND); + } + + // Handle all other exceptions + @ExceptionHandler(Exception.class) + public ResponseEntity handleGlobalException(Exception ex) { + return new ResponseEntity<>("Something went wrong: " + ex.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR); + } +} +👉 Now whenever any controller throws ResourceNotFoundException or any other exception, this centralized handler will catch it. +2. Custom Exception + Response Object +Better to return a structured JSON response instead of raw strings. +Example Custom Error Response. +public class ErrorResponse { + private String message; + private String details; + private int statusCode; + + public ErrorResponse(String message, String details, int statusCode) { + this.message = message; + this.details = details; + this.statusCode = statusCode; + } + + // getters and setters +} +Global Exception Handler Returning JSON. +@ControllerAdvice +public class GlobalExceptionHandler { + + @ExceptionHandler(ResourceNotFoundException.class) + public ResponseEntity handleResourceNotFound(ResourceNotFoundException ex) { + ErrorResponse error = new ErrorResponse(ex.getMessage(), "Resource not found", HttpStatus.NOT_FOUND.value()); + return new ResponseEntity<>(error, HttpStatus.NOT_FOUND); + } + + @ExceptionHandler(Exception.class) + public ResponseEntity handleGlobalException(Exception ex) { + ErrorResponse error = new ErrorResponse("Internal Server Error", ex.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR.value()); + return new ResponseEntity<>(error, HttpStatus.INTERNAL_SERVER_ERROR); + } +} +3. Using @ResponseStatus on Custom Exceptions +Quick way if you just want to map an exception → HTTP status. +@ResponseStatus(value = HttpStatus.NOT_FOUND) +public class ResourceNotFoundException extends RuntimeException { + public ResourceNotFoundException(String message) { + super(message); + } +} +4. Using ResponseEntityExceptionHandler +Spring provides a base class you can extend: + +@ControllerAdvice +public class GlobalExceptionHandler extends ResponseEntityExceptionHandler { + + @Override + protected ResponseEntity handleMethodArgumentNotValid( + MethodArgumentNotValidException ex, HttpHeaders headers, + HttpStatusCode status, WebRequest request) { + + Map errors = new HashMap<>(); + ex.getBindingResult().getFieldErrors().forEach(err -> + errors.put(err.getField(), err.getDefaultMessage()) + ); + + return new ResponseEntity<>(errors, HttpStatus.BAD_REQUEST); + } +} + +======================================================================================================== +Q31. How to synchronize HashMap ? +Ans : +1.Map map = Collections.synchronizedMap(new HashMap<>()); + synchronized(map) { + for (Map.Entry entry : map.entrySet()) { + System.out.println(entry.getKey() + ": " + entry.getValue()); + } +} +2. Map map = new ConcurrentHashMap<>(); + +***********************Capgemini****************************************22/3/2025 +Q32. What is single abstract method in java ? +Ans : its is a fucntional interface +=============================================================================================== +Q33. What is microservice designe pattern in java ? +Ans: +A. Service Discovery +B. Config server : common Git hub data all services +C. API Gateway : Single end points for all user and managinng traffic and routing +D. Circuit breaker : avoid fault taulrance +E. SAGA Design pattern : managing distributed transaction +F. Stragler Design pattern . +E. Per Database service .Example: Resilience4j, Zipkin, Hystrix +============================================================================================= +Q34. Reverse A Sentence Word By Word ? using java 8 + Input String : Java Concept Of The Day + Output String : Day The Of Concept Java + + String str "Day The Of Concept Java"; + String reversed = Arrays.stream(str.split(" ")).collect(Collectors.collectingAndThen(COllectors.toList(),list->{ + Collections.reverse(list); + return list.stream(); + })).collect(Collectors.joining(" ")); + + //reverse each word + String reveseEachWord = Arrays.stream(str.split(" ")).map(s->new StringBuilder(s).reverse().toString()).collect(Collectors.joining(" ")); +*****************************Nagaro*******************************************- +Q34. Can we pass Interface in Generic using java ? +Ans :Yes +// Define an interface +interface Animal { + void makeSound(); +} + +// Implement the interface in a class +class Dog implements Animal { + public void makeSound() { + System.out.println("Woof Woof!"); + } +} + +// Generic class that accepts only types implementing Animal +class AnimalHandler { + private T animal; + + public AnimalHandler(T animal) { + this.animal = animal; + } + + public void playSound() { + animal.makeSound(); + } +} + +// Main method to test +public class GenericInterfaceExample { + public static void main(String[] args) { + Dog dog = new Dog(); + AnimalHandler handler = new AnimalHandler<>(dog); + handler.playSound(); // Output: Woof Woof! + } +} +=========================================================================================== +Q34. Guess the output ? + + public static void objectTypeParameters(String string) { + System.out.println("string"); + } + public static void objectTypeParameters(StringBuffer stringBuffer) { + System.out.println("string buffer"); + } + + public static void objectTypeParameters(Object object) { + System.out.println("objects"); + } + public static void main(String[] args) { + AllPrograms.objectTypeParameters(null); + } + +o/p : Compile-time error: reference to objectTypeParameters(null) is ambiguous,ambiguity because for Two Child class of Object String and StringBuffer +============================================================================================ + +***********************Infosys contract*************************************************** +Q35. Which design pattern you are using in spring boot ? +Ans : +🔁 1. Singleton Pattern +Where: Spring beans by default are Singleton. +Purpose: Only one instance of a bean is created and shared throughout the application. + +Example: +@Service // or @Component, @Repository, etc. +public class AccountService { + // singleton bean by default +} +🧩 2. Dependency Injection (DI) / Inversion of Control (IoC) +Where: Everywhere — this is the core of Spring. +Purpose: Objects are injected (via constructor, setter, or field), not created manually. + +Example: +@RestController +public class AccountController { + private final AccountService service; + + @Autowired + public AccountController(AccountService service) { + this.service = service; + } +} +🔄 3. Proxy Pattern +Where: Used internally in AOP, transactions, and security. +Purpose: To wrap actual objects with proxies for adding extra behavior (e.g., logging, security, transactions). + +Example: When you annotate a method with @Transactional, Spring creates a proxy for that class. + +🌐 4. Factory Pattern +Where: Spring's ApplicationContext acts as a bean factory. +Purpose: Creates objects (beans) based on configuration. + +Example: @Bean methods or XML bean definitions. + +🔍 5. Template Method Pattern +Where: Used in JdbcTemplate, RestTemplate, etc. +Purpose: Defines a skeleton method, and allows subclasses to override parts of it. + +Example: +jdbcTemplate.query("SELECT * FROM users", rs -> { + // implement row mapping +}); +🔁 6. Observer Pattern +Where: Spring Events (ApplicationEventPublisher) +Purpose: One-to-many relationship where listeners are notified of changes. + +Example: +// Event +public class UserCreatedEvent extends ApplicationEvent {} + +// Listener +@EventListener +public void handleUserCreated(UserCreatedEvent event) {} +🧱 7. Builder Pattern +Where: Common in DTOs or object creation (esp. with Lombok). +Purpose: Simplifies object creation with many fields. + +Example: +User user = User.builder().name("Dev").age(25).build(); +=========================================================================================================== +Q36. How to handle 2 Max priority thread in singleTone class ? +Ans : +To handle two max priority threads in a Singleton class, you need to ensure: +Thread-safe Singleton implementation +Threads are coordinated properly, especially if both have MAX_PRIORITY. +✅ Step 1: Thread-safe Singleton Implementation (Double-Checked Locking) +public class Singleton { + private static volatile Singleton instance; + + private Singleton() { + // private constructor + } + + public static Singleton getInstance() { + if (instance == null) { + synchronized (Singleton.class) { + if (instance == null) + instance = new Singleton(); + } + } + return instance; + } + + public void doWork(String threadName) { + System.out.println("Executed by: " + threadName); + } +} +✅ Step 2: Create Two MAX_PRIORITY Threads +public class Main { + public static void main(String[] args) { + Runnable task = () -> { + Singleton singleton = Singleton.getInstance(); + singleton.doWork(Thread.currentThread().getName()); + }; + + Thread t1 = new Thread(task, "MaxPriority-Thread-1"); + Thread t2 = new Thread(task, "MaxPriority-Thread-2"); + + // Set MAX_PRIORITY + t1.setPriority(Thread.MAX_PRIORITY); + t2.setPriority(Thread.MAX_PRIORITY); + + t1.start(); + t2.start(); + } +} + +=================================================================================================== +****************************IRIS software********************************** +Q37.Sum with recursion function ? +Ans: +public static int sum(int n) { + if (n <= 0) { + return 0; + } + return n + sum(n - 1); + } + + + https://www.tutorialspoint.com/java/online-java-compiler.php Please write a simple function takes an integer n and uses recursion to calculate the sum of all numbers from 1 to n. +=================================================================================================== +Q38. what is pivot table in SQl ? +Ans: A Pivot Table in SQL is a technique used to transform row data into columns — often used to summarize, aggregate, or analyze data in a more readable or report-like format. +📊 Example Scenario +Imagine you have a Sales table: +| Product | Quarter | Sales | +| ------- | ------- | ----- | +| A | Q1 | 100 | +| A | Q2 | 150 | +| B | Q1 | 200 | +| B | Q2 | 250 | +❓ Goal (Pivot Result): +| Product | Q1 | Q2 | +| ------- | --- | --- | +| A | 100 | 150 | +| B | 200 | 250 | +🔁 Using PIVOT in SQL Server: +SELECT * FROM(SELECT Product, Quarter, Sales FROM Sales) AS SourceTable PIVOT(SUM(Sales) FOR Quarter IN ([Q1], [Q2])) AS PivotTable; +🧠 Key Concepts: +Rows to Columns: Values in a row become separate columns. +Aggregation: You usually apply an aggregate function (e.g., SUM, AVG, COUNT) on the pivoted values. +FOR ... IN (...): Defines the column headers dynamically created. +🔄 If your SQL dialect doesn't support PIVOT (e.g., MySQL): +You can emulate it using CASE + GROUP BY: +SELECT + Product, + SUM(CASE WHEN Quarter = 'Q1' THEN Sales ELSE 0 END) AS Q1, + SUM(CASE WHEN Quarter = 'Q2' THEN Sales ELSE 0 END) AS Q2 +FROM Sales +GROUP BY Product; +=========================================================================================== +Q39. what is default SQL Engine ? +Ans: The "default SQL engine" refers to the database engine used by a database system to store, retrieve, and manage data using SQL. The default engine depends on the database platform you're using. +📚 Examples by Database System: +| Database System | Default SQL Engine | Notes | +| --------------- | ------------------------------------ | -------------------------------------------------------------------------------- | +| **MySQL** | `InnoDB` | Supports transactions, foreign keys, row-level locking. Default since MySQL 5.5. | +| **SQL Server** | `SQL Server Database Engine` | Microsoft's proprietary engine with T-SQL support. | +| **Oracle** | `Oracle RDBMS Engine` | Oracle's own engine with PL/SQL. | +| **PostgreSQL** | `PostgreSQL Engine` | Open-source engine with full ACID compliance. | +| **SQLite** | `SQLite Engine` | Lightweight, file-based engine. | +| **MariaDB** | `InnoDB` (or `Aria` for temp tables) | Drop-in replacement for MySQL with similar defaults. | +============================================================================================= +Q40. what is relationship in SQl? +Ans: In SQL (Structured Query Language), a relationship defines how two or more tables are connected based on keys. Relationships help to normalize data and enforce referential integrity in relational databases. +🔗 Types of Relationships in SQL: +| Type | Description | +| ------------------- | --------------------------------------------------------------------------- | +| **1. One-to-One** | One record in Table A is related to one record in Table B. | +| **2. One-to-Many** | One record in Table A is related to **many** records in Table B. *(Common)* | +| **3. Many-to-One** | Many records in Table A relate to **one** record in Table B. | +| **4. Many-to-Many** | Many records in Table A relate to many records in Table B via a join table. | +📌 Example: One-to-Many (Most Common) +-- Table: Customers +CustomerID | Name +-----------|------- +1 | Alice +2 | Bob + +-- Table: Orders +OrderID | CustomerID | Product +--------|------------|--------- +101 | 1 | Laptop +102 | 1 | Phone +103 | 2 | Tablet +Relationship: One Customer → Many Orders +Using CustomerID as a foreign key in the Orders table. +ALTER TABLE Orders +ADD CONSTRAINT fk_customer +FOREIGN KEY (CustomerID) +REFERENCES Customers(CustomerID); +🔑 Keys Involved in Relationships +| Key Type | Description | +| --------------- | ------------------------------------------- | +| **Primary Key** | Uniquely identifies a row in a table. | +| **Foreign Key** | Refers to the primary key of another table. | +🧠 Why Relationships Matter? +Reduces data redundancy. +Ensures data integrity. +Enables JOIN operations to query across tables. +=================================================================================================== +Q41. ArrayList vs LinkedList? +Ans: Both ArrayList and LinkedList are part of the Java Collections Framework, implement the List interface, and store ordered collections. But they differ significantly in terms of internal structure, performance, and use cases. +🔍 1. Internal Structure +| Feature | `ArrayList` | `LinkedList` | +| -------------- | ---------------------------------------- | --------------------------------------------------- | +| Data Structure | Dynamic array (resizable array) | Doubly linked list | +| Storage | Elements stored in **contiguous memory** | Each node stores data + pointers to next & previous | +⚙️ 2. Performance (Big-O) +| Operation | `ArrayList` | `LinkedList` | +| -------------------------- | -------------------------- | ---------------------------------- | +| **Access (get/set)** | O(1) — fast (direct index) | O(n) — must traverse nodes | +| **Insert at end** | O(1) — usually (amortized) | O(1) — if tail is known | +| **Insert at middle/start** | O(n) — shift required | O(1) — addFirst(), addLast() | +| **Remove by index** | O(n) — shift required | O(n) — traversal + pointer update | +| **Remove first/last** | O(n) — shift required | O(1) — removeFirst(), removeLast() | +📌 3. Memory Usage +ArrayList uses less memory per element (only stores values). +LinkedList uses more memory because of next/prev node pointers. +🧠 4. When to Use What? +| Use Case | Use `ArrayList` | Use `LinkedList` | +| -------------------------------------------------------- | ----------------------- | ------------------------- | +| Frequent **random access** | ✅ Best choice | ❌ Not ideal | +| Frequent **insertions/deletions** at beginning or middle | ❌ Costly (shift needed) | ✅ Efficient with pointers | +| Memory efficiency is important | ✅ Less overhead | ❌ Higher due to nodes | +| Implementing a **queue/deque** | ❌ Not suitable directly | ✅ LinkedList is ideal | +========================================================================================================================= +Q42. How to debbug rest API if slow ? +Ans : +🛠️ 1. Use Spring Boot Actuator (If Using Spring Boot) +🧩 2. Enable Logging for Slow Requests +logging.level.org.springframework.web=DEBUG +logging.level.org.hibernate.SQL=DEBUG +🐢 3. Use Profiling Tools +| Tool | Description | +| -------------------------------------- | --------------------------------------------- | +| **Spring Boot DevTools** | Automatic reloads and live performance tweaks | +| **VisualVM / JProfiler** | JVM-level profiling | +| **Java Flight Recorder** | Built-in JVM profiler | +| **Postman Console / Chrome Dev Tools** | Measure actual API response times | +📦 4. Check for Common Bottlenecks +| Layer | What to Check | +| ----------------- | ----------------------------------------------- | +| **Controller** | Heavy computation or logging in API? | +| **Service Layer** | Blocking IO? Expensive operations? | +| **Repository** | N+1 queries? Inefficient joins or no indexes? | +| **Database** | Slow queries? Use `EXPLAIN PLAN` | +| **Network** | Is the server latency high? Use ping/curl tools | +🔄 5. Log API Timing (Custom) +long start = System.currentTimeMillis(); +// call service +long end = System.currentTimeMillis(); +System.out.println("API took: " + (end - start) + " ms"); +🧵 6. Asynchronous & Caching Fixes +Use @Async for long-running tasks. +Add caching using: +@Cacheable("users") +public User getUserById(Long id) { ... } +🔐 7. Thread Pool Saturation +@Bean +public Executor taskExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setCorePoolSize(5); + executor.setMaxPoolSize(10); + executor.setQueueCapacity(100); + return executor; +} +⚡ 8. Use APM Tools (Production) +| Tool | Description | +| ----------------------------------- | --------------------------- | +| **Zipkin / Jaeger** | Distributed tracing | +| **New Relic / Dynatrace / Datadog** | Enterprise-grade monitoring | +| **ELK Stack** | Analyze logs for patterns | +=================================================================================================================== +Q43. Unit testing vs itegration testing? +Ans: +🧪 Unit Testing +| Aspect | Description | +| ---------------- | --------------------------------------------------------------- | +| **Purpose** | Test **individual units** (e.g., methods, classes) in isolation | +| **Scope** | Narrow (only one class or method at a time) | +| **Dependencies** | Mocked or stubbed (no actual DB, services, or network) | +| **Speed** | Very fast | +| **Tools** | JUnit, Mockito, NUnit, xUnit | +| **Focus** | Logic correctness of isolated code units | +🧱 Example: +@Test +void testAddNumbers() { + Calculator calc = new Calculator(); + assertEquals(5, calc.add(2, 3)); +} +🔗 Integration Testing +| Aspect | Description | +| ---------------- | ------------------------------------------------------- | +| **Purpose** | Test how **multiple units/components** work together | +| **Scope** | Broad (e.g., controller + service + repository) | +| **Dependencies** | Real or embedded (e.g., in-memory DB like H2) | +| **Speed** | Slower than unit tests | +| **Tools** | Spring Boot Test, Testcontainers, Postman, RestAssured | +| **Focus** | Data flow, integration points, and configuration issues | +🌐 Example: +@SpringBootTest +@AutoConfigureMockMvc +public class UserControllerIntegrationTest { + + @Autowired + private MockMvc mockMvc; + + @Test + void testGetUser() throws Exception { + mockMvc.perform(get("/users/1")) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.name").value("John")); + } +} +🔍 Summary Table +| Feature | Unit Test | Integration Test | +| --------------------- | --------------------------- | ----------------------------------- | +| **Goal** | Test logic of one component | Test collaboration of components | +| **Speed** | Fast | Slower | +| **Dependencies** | Mocked | Real or in-memory | +| **Failures indicate** | Bug in logic | Bug in integration/config | +| **Examples** | Service method, Utils | REST API, DB + Service + Controller | +================================================================================================= +Q44. What is Code quality tools? +Ans : +Code Quality Tools are software solutions that analyze your codebase to ensure it meets defined standards in terms of: +Readability +Maintainability +Performance +Security +Best practices +🧰 Common Code Quality Tools +| Tool | Language Support | Purpose | +| ----------------------- | -------------------------- | ------------------------------------------------------------------ | +| **SonarQube** | Java, C#, JS, Python, etc. | Detects bugs, code smells, security vulnerabilities | +| **PMD** | Java, Apex, others | Finds common coding issues (unused vars, empty catch blocks, etc.) | +| **Checkstyle** | Java | Enforces coding style and conventions | +| **FindBugs / SpotBugs** | Java | Analyzes bytecode for potential errors | +| **ESLint** | JavaScript, TypeScript | Linting (style + error checks) for JS/TS | +| **StyleCop** | C# | Style checking for .NET projects | +| **Coverity** | Multiple | Static code analysis and security review | +| **FxCop** | .NET | Analyzes .NET assemblies for violations | +| **Detekt** | Kotlin | Kotlin static code analysis | +| **ReSharper** | .NET, JavaScript | Code analysis, refactoring suggestions | +==================================================================================================================================== +Q45. String vs StringBuilder? +Ans :Both String and StringBuilder are used to handle textual data, but they have important differences in mutability, performance, and usage. +🔍 1. Mutability +| Feature | `String` | `StringBuilder` | +| ------------------ | --------------------------------------- | ------------------------------------ | +| **Mutable?** | ❌ Immutable | ✅ Mutable | +| **What it means?** | Every modification creates a new object | Modifications update the same object | +String s = "Hello"; +s = s + " World"; // Creates a new object + +StringBuilder sb = new StringBuilder("Hello"); +sb.append(" World"); // Modifies the same object +🔄 2. Performance +| Scenario | Best Choice | +| ---------------------------------------------------- | ----------------- | +| Frequent string modifications (e.g., loops, appends) | ✅ `StringBuilder` | +| Constant/rare modifications | ✅ `String` | +🧵 3. Thread Safety +| Feature | `String` | `StringBuilder` | `StringBuffer` | +| ------------------------- | ------------- | --------------- | -------------- | +| Thread-safe | ✅ (Immutable) | ❌ | ✅ | +| Use in multi-threaded env | ✅ | ❌ | ✅ | +📌 4. When to Use What? +| Use Case | Use This | +| ------------------------------------- | --------------- | +| Small, fixed text or literals | `String` | +| Large or frequently changed text | `StringBuilder` | +| Thread-safe modifications (rare case) | `StringBuffer` | +=============================================================================================================================== +Q46. O(n) vs O(1) ? +Ans:🔹 What is Time Complexity? +It describes how the runtime of an algorithm increases with input size. +📌 O(1): Constant Time +Definition: The time taken is independent of the input size. +Real-life Analogy: Looking at the first page of a book. +Example: +int getFirst(int[] arr) { + return arr[0]; // Always takes the same time +} +📌 O(n): Linear Time +Definition: The time increases linearly with the input size. +Real-life Analogy: Reading every page in a book one by one. +void printAll(int[] arr) { + for(int i = 0; i < arr.length; i++) { + System.out.println(arr[i]); // Time increases as array size grows + } +} +⚡ Use Cases +O(1): + +HashMap get(key) +Array arr[index] +Stack push(), pop() (in most cases) + +O(n): + +Linear search +Traversing LinkedList +Summing all elements in an array +| Aspect | O(1) | O(n) | +| --------------------- | ------------------------- | ------------------------- | +| Time Growth | Constant | Linear | +| Performance (large n) | Fast | Slower as n increases | +| Examples | Accessing `arr[i]` | Loop through all elements | +| Space Complexity | Usually small or constant | Depends on implementation | +============================================================================================= +Q47. What is NullPointerException ? +Ans : A NullPointerException in Java is a runtime exception that occurs when your program tries to use null like it’s an actual object. +In simple terms: +👉 You’re calling a method or accessing a variable on an object that doesn’t exist (it’s null). +String name = null; +System.out.println(name.length()); // ❌ NPE +int[] numbers = null; +System.out.println(numbers[0]); // ❌ NPE + +********************HCL*********************************************** +Q48. Load vs Capicity in Azile JIRA? +Ans: +✅ Capacity +Definition: The total amount of work the team can do in a sprint. +It’s based on team availability (working hours, leaves, holidays). +Measured in story points or hours. +Example: +Team has 5 members. +Each member has ~6 hours/day for 10 working days = 300 hours capacity. +In story points, maybe the team’s velocity (average from last sprints) = 40 story points capacity. +👉 Capacity = Theoretical maximum workload the team can take in a sprint. + +✅ Load +Definition: The actual work assigned/committed to the team for the sprint. +It’s how much work you have planned (stories, tasks) against the team’s capacity. +Example: +If you assign 45 story points of work to the sprint but capacity is 40 → team is overloaded. +If you assign 30 story points when capacity is 40 → team is underloaded. + +👉 Load = Planned/committed work against the capacity. + +✅ Relationship in JIRA + +In JIRA Agile Sprint Planning, you: +First calculate capacity (based on team availability). +Then assign issues (stories, tasks) → this becomes the load. +JIRA (with proper add-ons like Advanced Roadmaps or Tempo Planner) can show whether your team is under/over capacity. +🎯 Example +Team capacity (from velocity/availability) = 40 story points +Work assigned (load) = 50 story points +➡ Overloaded sprint (10 points over capacity). + +🔑 In short: +Capacity = how much work the team can do. +Load = how much work the team is actually given. +=============================================================================================== +Q49. What is API Gateway? +Ans: +An API Gateway is a single entry point for clients to interact with a system of microservices. +Instead of calling each microservice directly, the client (web app, mobile app, etc.) sends requests to the API Gateway, which then: +Routes the request to the correct microservice +Aggregates responses (if needed) +Applies cross-cutting concerns (security, logging, rate limiting, etc.) + +👉 Think of it as the front door of your microservices architecture. + +✅ Why API Gateway is needed? +Simplifies client interaction → clients don’t need to know about individual microservices. +Security → central place for authentication/authorization. +Load balancing → distributes requests among service instances. +Cross-cutting features → logging, caching, monitoring, retries. +Protocol translation → e.g., client uses HTTP/JSON, internal services use gRPC or AMQP. +✅ Real-world API Gateways + +Netflix Zuul (older, Java-based) +Spring Cloud Gateway (modern, Java, reactive) +AWS API Gateway (cloud-managed service) +Kong (popular, open-source, plugin-based) +NGINX / HAProxy (reverse proxies that can act as gateways) +✅ Example +Without API Gateway: +Client → Service A +Client → Service B +Client → Service C +❌ Client must know each service’s address. + +With API Gateway: +Client → API Gateway → Service A / Service B / Service C + +✅ Summary +API Gateway = single entry point to microservices. +It handles routing, security, monitoring, aggregation, rate limiting. +Improves client simplicity, security, and scalability. + +🔹 API Gateway vs Load Balancer +| Feature | **API Gateway** | **Load Balancer** | +| -------------------------- | ----------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| **Purpose** | Acts as a **single entry point** for clients to access microservices. | Distributes incoming requests across multiple instances of the same service. | +| **Granularity** | Works at **application level** (Layer 7 – HTTP/HTTPS, gRPC). | Works at **network/transport level** (Layer 4 – TCP/UDP or Layer 7 for HTTP). | +| **Routing** | Routes requests to **different services** (e.g., `/users → User Service`, `/orders → Order Service`). | Routes requests to **different instances** of the **same service** (e.g., User Service instance 1, 2, 3). | +| **Cross-cutting concerns** | Can handle **authentication, authorization, rate limiting, caching, logging**. | Just balances the load (does not handle security or cross-cutting features). | +| **Response aggregation** | Can **aggregate results** from multiple microservices and return a single response. | Does not aggregate responses. | +| **Client visibility** | Hides the internal microservice structure from the client. | Client still needs to know which service to call, only hides individual instances. | +| **Examples** | Spring Cloud Gateway, Zuul, Kong, AWS API Gateway. | NGINX, HAProxy, AWS ELB/ALB, GCP Load Balancer. | + +🔹 Analogy +Load Balancer = Like a restaurant host who decides which waiter (instance) will serve you. +API Gateway = Like a reception desk in a hotel, where you ask for any service (room service, housekeeping, restaurant), and they forward your request to the right department. + +🔹 When to use +Use a Load Balancer when you just need to scale one service horizontally. +Use an API Gateway when you have multiple microservices and need routing + security + monitoring. +Often, both are used together: +============================================================================================== +Q50. Shcema in API Gateway ? +Ans :🔍 Summary: +| Schema | Meaning | +| ---------- | ----------------------------------------------------------------------- | +| `http://` | Route to a service with a static HTTP URL | +| `https://` | Route to a service using secure HTTPS | +| `lb://` | Route to a **load-balanced service name** (via Eureka/Discovery client) | +✅ Example: Using lb:// (most common with microservices) +spring: + cloud: + gateway: + routes: + - id: user-service + uri: lb://USER-SERVICE + predicates: + - Path=/users/** +✅ Example: Using http:// for a fixed service +- id: external-api + uri: http://localhost:8081 + predicates: + - Path=/external/** +🔐 Optional — Secure with https:// +- id: secure-api + uri: https://secure-service.com + predicates: + - Path=/secure/** +========================================================================================================= +Q51. What is the input in API Gateway +Ans :In the context of Spring Cloud API Gateway (or any API Gateway), the input is typically: +🡺 An HTTP Request (from a client: browser, mobile app, frontend, Postman, etc.) +🔷 Types of Input: +The input to the API Gateway can consist of: +| Part | Example / Details | +| ------------------ | ----------------------------------------------------- | +| **HTTP Method** | `GET`, `POST`, `PUT`, `DELETE`, etc. | +| **URL Path** | `/users/1`, `/hotels`, etc. | +| **Query Params** | `/users?id=1` | +| **Headers** | `Authorization: Bearer `, `Content-Type`, etc. | +| **Body (Payload)** | JSON or XML (for POST/PUT) | +| **Cookies** | For session info, if applicable | +===================================================================================================== +Q52. What is the size in API Gateway ? +Ans :🔷 1. Request/Response Payload Size +This is the most common meaning. +| Type | Description | +| ----------------- | ----------------------------------------------------------------------------- | +| **Request Size** | Size of the incoming HTTP request body (e.g., JSON file, file upload, etc.) | +| **Response Size** | Size of the HTTP response from the microservice sent back through the gateway | +🔐 Why It Matters? +API Gateway may limit the size to prevent overload or abuse. +Too large payloads can cause 413 Payload Too Large errors. +🔧 How to Configure Request Size in Spring Cloud Gateway: +spring: + cloud: + gateway: + httpclient: + max-initial-line-length: 8192 # Max size of request line + max-header-size: 16KB # Max size of headers + max-chunk-size: 8KB # Max chunk for transfer encoding + max-content-length: 10MB # Total payload size limit +🔷 2. Number of Routes / Services +Refers to how many microservices the gateway is routing to. +Impacts scalability and maintainability. +🔷 3. Rate Limiting Size +Number of allowed requests per time window (e.g., 100 requests per minute). +ratelimiter: + instances: + userRateLimiter: + limit-refresh-period: 1s + limit-for-period: 5 +| Size Context | Example | +| -------------------- | ------------------------------- | +| Request Payload Size | JSON body: 1MB | +| Response Size | API returns image: 5MB | +| Header Size | Cookies + JWT tokens | +| Number of Routes | 10 microservices behind gateway | +| Rate Limit Size | 100 req/min per user | +=========================================================================================================== +Q53. Map Vs Set ? +Ans: +🔹 1. Set +A Set is a collection of unique elements (no duplicates allowed). +Follows mathematical set rules. +Does not maintain index (unlike a List). +Can allow null (depending on implementation). +Used when you only care about existence of elements, not key-value mapping. + +👉 Examples: +HashSet → Unordered, fast lookup. +LinkedHashSet → Maintains insertion order. +TreeSet → Sorted order (based on natural ordering or Comparator). + +🔹 2. Map +A Map stores key-value pairs. +Keys must be unique, but values can be duplicate. +Each key maps to exactly one value. +Useful when you need fast lookups based on a key. + +👉 Examples: +HashMap → Unordered, fast lookup. +LinkedHashMap → Maintains insertion order. +TreeMap → Sorted order (by keys). +🔹 Key Differences: +| Feature | **Set** | **Map** | +| ----------------- | ------------------------------------- | --------------------------------------------- | +| **Storage** | Stores only elements (unique values). | Stores key-value pairs. | +| **Uniqueness** | No duplicates allowed. | Keys must be unique, values can repeat. | +| **Access** | Accessed via iteration (no index). | Accessed via key. | +| **Null Handling** | At most one `null` element. | One `null` key (HashMap), many `null` values. | +| **Use Case** | When only unique elements matter. | When you need mapping from key → value. | + +=========================================================================================================== +Q54. Who maintains session in Spring Boot? +Ans :In Spring Boot, session management is typically handled by the Servlet container (like Tomcat, Jetty, or Undertow) integrated with Spring Boot. However, Spring Session can be introduced for advanced, scalable session handling. +🔹 1. By Default: Servlet Container (e.g., Tomcat) +When using Spring Boot (with spring-boot-starter-web), it uses embedded Tomcat. +HTTP sessions are maintained via: +JSESSIONID cookie (most common) +URL rewriting (;jsessionid=...) — less common now +🧠 The Servlet container: +Stores session objects in memory. +Tracks user session via HttpSession. + +Automatically creates sessions when needed. +🔹 2. Using Spring Session (Optional Advanced Way) +If your app is distributed (multiple instances), using the default session mechanism isn't scalable. Instead, use: +✅ Spring Session to store sessions: +In Redis (spring-session-data-redis) +In JDBC database +In Hazelcast +🧠 Summary +| Method | Who Maintains Session? | Scalable? | +| ---------------- | -------------------------- | ----------------------| +| Default (Tomcat) | Servlet Container | ❌ (only in-memory) | +| Spring Session | External Store (Redis, DB) | ✅ (distributed apps) | +========================================================================================================================= +Q55. What is microservice design pattern ? +Ans: In Microservices Architecture, design patterns are well-known solutions to common problems that arise when building, deploying, and managing microservices. +🔹 1. Decomposition Patterns +These help in breaking a monolith into smaller microservices. +Decompose by Business Capability → Each service focuses on one business function (e.g., Order Service, Payment Service). +Decompose by Subdomain (from Domain-Driven Design) → Break system based on bounded contexts. +Strangler Fig Pattern → Gradually replace parts of a monolith with microservices without rewriting everything at once. + +🔹 2. Integration Patterns +How services talk to each other. +API Gateway → A single entry point for clients, routes requests to appropriate services. +Aggregator → Collects data from multiple services and returns a single response. +Proxy → Routes requests without modification. +Chained Service (or Orchestration) → One service calls another in sequence to complete a request. + +🔹 3. Database Patterns +Each service usually has its own database. +Database per Service → Each microservice owns its schema. +Shared Database (anti-pattern, but sometimes used for legacy reasons). +Saga Pattern → Distributed transactions handled via events or choreography/orchestration. +CQRS (Command Query Responsibility Segregation) → Separate models for reads and writes. +Event Sourcing → Store changes as a series of events instead of just the latest state. + +🔹 4. Observability Patterns +How to monitor and debug. +Log Aggregation → Centralized logging for all services. +Distributed Tracing → Track a request across multiple services (e.g., Zipkin, Jaeger). +Metrics Collection → Gather service health stats (e.g., Prometheus, Micrometer). +Health Check API → Each service exposes an endpoint to report its health (used by Kubernetes, load balancers). + +🔹 5. Reliability Patterns +Ensures system stability even if some services fail. +Circuit Breaker → Stop calling a failing service temporarily. +Bulkhead → Isolate failures in one part of the system so they don’t cascade. +Retry Pattern → Retry failed requests with backoff. +Timeouts → Don’t let one service hang forever waiting on another. + +🔹 6. Security Patterns +Access Token (JWT, OAuth2) → Secure inter-service and client communication. +API Gateway Security → Authentication & authorization at the gateway. +Service-to-Service Authentication → mTLS, service mesh (e.g., Istio). + +✅ In summary: +Microservice design patterns give us best practices for: +Breaking down a system (Decomposition) +Connecting services (Integration) +Managing data (Database patterns) +Keeping things observable (Monitoring & Logging) +Ensuring stability (Reliability) +Securing everything (Security) +======================================================================================================================== +Q56. How to get properties values from property file. +Ans : +1.Using @Value Annotation. + @Value("${app.name}") + private String appName; + +2. Using @ConfigurationProperties (Recommended for grouped values) +application.property +student.name=John +student.age=21 +student.grade=A + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = "student") +public class StudentProperties { + + private String name; + private int age; + private String grade; + + // Getters and Setters +} +3. Injecting Environment +import org.springframework.core.env.Environment; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class EnvReader { + + @Autowired + private Environment env; + + public void printEnv() { + String name = env.getProperty("student.name"); + System.out.println("Student Name: " + name); + } +} +============================================================================================ +Q57. Convert Arrays to List +Ans : +String[] array = {"Java", "Python", "C++"}; +List list Arrays.asList(array); +============================================================================================= +Q58. How to Synchronized collection? +Ans: +🔹 Example: Synchronized List +✅ 1. Using Collections.synchronizedXXX() +List list = Collections.synchronizedList(new ArrayList<>()); +// Always use synchronized block while iterating +synchronized (list) { + for (String s : list) { + System.out.println(s); + } +} +Supported: +Collections.synchronizedList() +Collections.synchronizedSet() +Collections.synchronizedMap() +✅ 2. Using CopyOnWriteArrayList, ConcurrentHashMap, etc. (Java 5+) +✅ 3. Use Collections.synchronizedCollection() for generic types +Collection collection = Collections.synchronizedCollection(new ArrayList<>()); +=========================================================================================== +Q59. How to short collection ? +Ans: +🔹 1. Sort List of Integers (Ascending / Descending) +List list = Arrays.asList(5, 3, 8, 1); +Collections.sort(list); // Ascending +// OR +Collections.sort(list, Collections.reverseOrder()); // Descending +🔹 2. Sort Using Java 8 Stream +List sorted = list.stream() + .sorted() // Ascending + .collect(Collectors.toList()); + +List reverseSorted = list.stream() + .sorted(Comparator.reverseOrder()) + .collect(Collectors.toList()); +🔹 3. Sort List of Strings +List names = Arrays.asList("Niraj", "Amit", "Zoya", "Ravi"); +Collections.sort(names); // Alphabetical +🔸 Sort by Name (Java 8) +list.sort(Comparator.comparing(Employee::getName)); +🔸 Sort by ID descending +list.sort(Comparator.comparing(Employee::getId).reversed()); +✅ Summary +| Requirement | Method | +| ------------------- | -------------------------------------------- | +| Sort primitive list | `Collections.sort()` or `.stream().sorted()` | +| Custom sort | `Comparator` or method reference | +| Descending order | `Comparator.reverseOrder()` | +| Sort custom objects | `Comparator.comparing()` | +================================================================================================== +Q60. What is Generic? +Ans: +🔹 What is Generic in Java? +Generics in Java allow you to write classes, interfaces, and methods with type parameters so they can work with any data type in a type-safe way, instead of writing the same code multiple times for different types. + +👉 In simple words: +Before Generics → We stored objects, and casting was required. (Risk of ClassCastException) +With Generics → We define the type at compile time. (Type safety, no casting). +1.🔹 Example Without Generics (Old way, JDK 1.4) +public class WithoutGenerics{ + public static void main(String[] args){ +List list = new ArrayList<>(); // Raw type +list.add("java"); +list.add(100); //oops! Allowed, no type safety + +String str = (String) list.get(0); // Need casting +String num = (String) list.get(1) //ClassCastException at run time + } +} + +2.🔹 Example With Generics (Modern way, JDK 1.5+) +public class WithGenerics{ + public static void main(String[] args){ +List list = new ArrayList<>(); // type safety +list.add(10); +list.add("string"); // compile time error + +Integer num = list.get(0); // No casting required + } + +} +==================================================================================================== +Q61. Where we use environment variables in Spring Boot? +Ans : +1. In application.yml or application.properties +spring: + datasource: + url: ${DB_URL} + username: ${DB_USERNAME} + password: ${DB_PASSWORD} +2. Using @Value Annotation +@Value("${DB_USERNAME}") +private String dbUsername; +📌 Why use environment variables? +To avoid hardcoding secrets +Enable configuration per environment (dev/stage/prod) +Easier deployment with Docker/K8s/Cloud +================================================================================================= + +*****************************Divergent*********************************************************** +Q62. Post v/s Put +Ans:🔹 POST vs PUT in REST API +| Feature | **POST** | **PUT** | | | | +| --------------------- | -------------------------------------------------------------------- |---------------------------------------------------------- +| **Purpose** | Create a **new resource** | Create **or update** an existing resource +| **Idempotent?** | ❌ No (calling multiple times creates duplicates) | ✅ Yes (calling multiple times has the same effect as once) | +| **Resource Location** | Server usually generates the ID (e.g., `/users`) | Client specifies the ID (e.g., `/users/101`) | +| **When to Use** | - Creating new records
- Submitting forms
- Uploading data | - Updating an existing record
- Replacing a resource completely +| **Request Body** | Data to create a new resource | Full data for update (or create if doesn’t exist) | +| **Response Code** | `201 Created` | `200 OK` (updated) or `201 Created` (if new resource created) + + +🔹 PUT vs PATCH +| Feature | **PUT** | **PATCH** | +| ----------------- | --------------------------------------------- | ------------------------------------------------------ | +| **Purpose** | Replaces the **entire resource** | Updates **part of a resource** | +| **Idempotent?** | ✅ Yes (repeating request gives same result) | ⚠️ Not strictly idempotent (depends on implementation) | +| **Request Body** | Full resource data (all fields) | Only fields that need to change | +| **Use Case** | When you want to **replace** an entire record | When you want to **modify specific attributes** | +| **Response Code** | `200 OK` (updated) or `201 Created` | `200 OK` or `204 No Content` | +🔹 Example +1. PUT +👉 Replace entire resource (overwrite existing). +PUT /users/101 +Content-Type: application/json + +{ + "id": 101, + "name": "John Doe", + "email": "john.doe@example.com" +} +✅ If "address" existed before, but is missing here → it gets removed (because PUT replaces whole object). + +2. PATCH +👉 Update only specific fields (partial update). +PATCH /users/101 +Content-Type: application/json + +{ + "email": "new.email@example.com" +} +✅ Only email is updated, other fields (like name, address) remain unchanged. +🔹 Summary +POST → Create new +PUT → Full update / replace +PATCH → Partial update +================================================================================================== +Q63. @Qualifire vs @Primary? +Ans: +================================================================================================== +Q64. Can we use @Component annotation in Repository instead of @Repository annotations +Ans : Yes, you can technically use @Component instead of @Repository — but it's not recommended for repositories. Here's why: +❗ But why @Repository is preferred? +Semantics / Readability +@Repository clearly tells other developers this class is responsible for persistence/database operations. +Improves code clarity and maintainability. +Exception Translation +@Repository enables automatic translation of JPA or JDBC exceptions into Spring’s DataAccessException. +@Component doesn’t do this. +====================================================================================================== +Q65. What is Deadlock in java? +Ans: Deadlock is a situation in multithreading where two or more threads are blocked forever, waiting for each other to release locks. +🔁 Example Scenario: +Thread 1 holds Lock A, and waits for Lock B +Thread 2 holds Lock B, and waits for Lock A +This creates a circular wait → deadlock +🧠 Core Conditions for Deadlock: +Mutual Exclusion – Only one thread at a time can use a resource. +Hold and Wait – A thread holds one resource and waits for another. +No Preemption – Resources cannot be forcibly taken from threads. +Circular Wait – Two or more threads form a circular chain of dependencies. +======================================================================================================= +Q66. Exaplain all @Transactional annotation ? +Ans: +1️⃣ What is @Transactional? +@Transactional is an annotation in Spring Framework that manages transaction boundaries automatically. +When a method annotated with @Transactional is executed: +A transaction starts before the method executes. +If the method completes successfully, the transaction is committed. +If an exception occurs (depending on the type), the transaction is rolled back. + +2️⃣ Where can we use it? +@Transactional can be applied to: +Methods: most common usage. +Classes: applies to all public methods of the class. +Example: +@Service +@Transactional +public class StudentService { + public void addStudent(Student student) { + // This method is transactional + } + public void updateStudent(Student student) { + // Also transactional + } +} +Or method-level: +@Service +public class StudentService { + + @Transactional + public void addStudent(Student student) { + // transactional + } + public void updateStudent(Student student) { + // not transactional + } +} +3️⃣ Important Attributes of @Transactional +The @Transactional annotation has several attributes to customize transaction behavior: + +a) propagation: +Defines how transactions relate to each other. Default: REQUIRED. +| Type | Meaning | +| ------------- | --------------------------------------------------------------------- | +| REQUIRED | Join existing transaction or create a new one if none exists. | +| REQUIRES_NEW | Always create a new transaction, suspend existing one. | +| NESTED | Execute within a nested transaction if a parent exists. | +| SUPPORTS | Execute within transaction if exists, else non-transactional. | +| NOT_SUPPORTED | Execute non-transactionally, suspending existing one. | +| NEVER | Execute non-transactionally, throw exception if a transaction exists. | +| MANDATORY | Must run within a transaction, else throw exception. | + +b) isolation: +Defines the isolation level of the transaction (avoids dirty reads, non-repeatable reads, phantom reads). +| Type | Meaning | +| ---------------- | ----------------------------------------- | +| DEFAULT | Use default of the underlying DB | +| READ_UNCOMMITTED | Can read uncommitted changes (dirty read) | +| READ_COMMITTED | Can only read committed changes | +| REPEATABLE_READ | Prevents non-repeatable reads | +| SERIALIZABLE | Most strict, prevents phantom reads | + +c) readOnly +true → Optimized for read-only operations (no flush, no unnecessary locks). +false → Default, allows insert/update/delete. +Example: +@Transactional(readOnly = true) +public List getAllStudents() { + return studentRepo.findAll(); +} +d) timeout +Maximum time (in seconds) the transaction can run. +If exceeded, transaction rolls back. +Example: +@Transactional(timeout = 5) // rollback if takes more than 5 seconds +public void processStudent() { + ... +} +e) rollbackFor / rollbackForClassName +Specify which exceptions trigger rollback. +@Transactional(rollbackFor = {IOException.class, SQLException.class}) +public void saveData() { + ... +} +Default behavior: unchecked exceptions (RuntimeException) roll back, checked exceptions do not. + +f) noRollbackFor / noRollbackForClassName +Specify which exceptions should not trigger rollback. +@Transactional(noRollbackFor = IllegalArgumentException.class) +public void updateData() { + ... +} +g) value / transactionManager +To specify which transaction manager to use in case of multiple databases. +Example: +@Transactional(transactionManager = "myTransactionManager") +public void saveData() { ... } + +4️⃣ Common Points to Remember +Only public methods are transactional by default. Calling a transactional method internally within the same class won’t start a transaction. +Transactions work on runtime proxies in Spring AOP. Hence, self-invocation doesn’t trigger transaction. +Rollback behavior: by default rolls back on unchecked exceptions, not checked exceptions. +Can be applied on class or method, method-level overrides class-level. + +✅ Example Combining Attributes +@Service +public class StudentService { + + @Transactional( + propagation = Propagation.REQUIRES_NEW, + isolation = Isolation.SERIALIZABLE, + readOnly = false, + timeout = 10, + rollbackFor = SQLException.class + ) + public void saveStudent(Student student) { + // complex transaction logic here + } +} + +======================================================================================================= +Q67. Starter dependency in spring boot ? +Ans: +1️⃣ What is a Starter Dependency? +A starter dependency in Spring Boot is a convenient set of dependencies bundled together in a single dependency. +Instead of adding individual JARs for Spring, Hibernate, Jackson, Logging, etc., you just add one starter and it pulls all required libraries through Maven/Gradle transitive dependencies. +They usually follow the naming convention: +spring-boot-starter- +2️⃣ How it Works? +Example in pom.xml: + + org.springframework.boot + spring-boot-starter-web + +👉 This one line will bring: +Spring MVC +Jackson (for JSON serialization/deserialization) +Tomcat (embedded server) +Validation libraries +Logging (spring-boot-starter-logging) +So you don’t need to add all individually. + +3️⃣ Common Spring Boot Starter Dependencies +Here’s a list of the most commonly used: + +Core Starters: +spring-boot-starter → Core starter, includes auto-configuration, logging, YAML, etc. +spring-boot-starter-test → JUnit, Mockito, AssertJ, Hamcrest, Spring Test (for unit and integration tests). + +Web & Template: +spring-boot-starter-web → Build web apps (Spring MVC + REST + Tomcat). +spring-boot-starter-webflux → Reactive web applications. +spring-boot-starter-thymeleaf → Template engine (Thymeleaf). + +Data & Database: +spring-boot-starter-data-jpa → Spring Data JPA with Hibernate + JDBC. +spring-boot-starter-data-mongodb → MongoDB database. +spring-boot-starter-data-redis → Redis database. +spring-boot-starter-jdbc → Plain JDBC with HikariCP connection pool. + +Security & Authentication: +spring-boot-starter-security → Spring Security. +spring-boot-starter-oauth2-client → OAuth2/OpenID Connect clients. +spring-boot-starter-oauth2-resource-server → Secure REST APIs with OAuth2. + +Messaging: +spring-boot-starter-amqp → RabbitMQ. +spring-boot-starter-data-redis → Redis. +spring-boot-starter-kafka → Apache Kafka. + +Cloud / Misc: +spring-boot-starter-actuator → Monitoring and management endpoints. +spring-boot-starter-validation → Bean validation (Hibernate Validator). +spring-boot-starter-mail → Sending emails. +spring-boot-starter-batch → Spring Batch for large-scale batch processing. +====================================================================================================== +Q68. Find Employee by name ascending order, who have greater than 3000 salary? +Ans: +List result = employees.stream() + .filter(emp -> emp.getSalary() > 3000) // filter salary > 3000 + .sorted(Comparator.comparing(Employee::getName)) // sort by name ascending + .collect(Collectors.toList()); +===================================================================================================== +Q69. How to call method ? +class Test{ + public void show(Object obj) + public void show(String string) + public void show(Integer ints) + public void show(int ins) + + public static void main(String args[]){ + Test t = new Test(); + + t.show("Hello"); // Calls show(String) + t.show(10); // Calls show(int) + t.show(Integer.valueOf(20)); // Calls show(Integer) + t.show(new Object()); // Calls show(Object) + t.show(null); // Compilation error: ambiguous method call because we have 2 object and both default value is null + } + +} +===================================================================================================== +Q70. ArrayList vs LinkedList +Ans : + +Q71. What is HashMap Collision? +Ans: A collision occurs when two different keys produce the same array index after applying the hash function. +HashMap map = new HashMap<>(); +map.put(1, "A"); +map.put(17, "B"); // Suppose array length = 16 +1.hashCode() % 16 = 1 +17.hashCode() % 16 = 1 +➡️ Both map to the same bucket index (1) → Collision. + +3️⃣ How HashMap Handles Collisions (Java 7 vs Java 8) +🔹 Java 7 (Linked List) + +Collisions are handled using a linked list inside each bucket. +If multiple keys map to the same bucket: +They are added to a linked list in that bucket. +When retrieving, HashMap compares keys using equals(). + +So: +First, hashCode() decides the bucket. +If multiple keys are in the same bucket, equals() decides the correct key. + +🔹 Java 8 and Later (Balanced Tree) +If too many collisions occur in the same bucket (more than 8 entries by default), +HashMap converts the linked list into a balanced Red-Black Tree. +Advantage: Lookup time improves from O(n) → O(log n) in worst case. + +4️⃣ Simple Example of Collision +HashMap map = new HashMap<>(); +map.put("FB", "Facebook"); +map.put("Ea", "Earth"); + +"FB".hashCode() == "Ea".hashCode() → same bucket (collision). +But "FB".equals("Ea") → false, so both are stored in the same bucket list/tree. + +Q72. Why Functional interface containing static and default method ? +Ans : +1. default methods +These provide a concrete implementation that can be inherited by implementing classes. + +2. static methods +These belong to the interface itself, not the implementation class. +✅ Static methods are utility methods—they don't affect how lambda expressions are assigned to the interface. + +1️⃣ What is a Functional Interface? + +A Functional Interface (introduced in Java 8) is an interface that has exactly one abstract method. +Example: Runnable, Callable, Comparator, Consumer, etc. +@FunctionalInterface +public interface MyFunc { + void execute(); // single abstract method (SAM) +} +2️⃣ Then why allow static and default methods? 🤔 +The rule is: +👉 A functional interface must have exactly one abstract method, +but it can have multiple default and static methods because those are not abstract. + +Default Methods: +Introduced in Java 8 to support interface evolution without breaking existing implementations. +They provide a method body inside the interface. +Does not count as an abstract method. +@FunctionalInterface +public interface MyFunc { + void execute(); // single abstract method + + default void log(String msg) { + System.out.println("Log: " + msg); + } +} +👉 Now any implementing class or lambda can use log() without needing to implement it. +👉 Still valid FI because only 1 abstract method exists. + +🔹 Static Methods: +Static methods in interfaces belong to the interface itself, not to the instances. +They are utility/helper methods inside the interface. +They also don’t count as abstract methods. + +Example: +@FunctionalInterface +public interface MyFunc { + void execute(); + + static void info() { + System.out.println("Static method in interface"); + } +} +Usage: +MyFunc.info(); // accessed via interface name + +3️⃣ Why Did Java Allow This? + +👉 To make functional interfaces more powerful and flexible while keeping backward compatibility. +Default methods → Let interfaces evolve (add new behavior) without breaking all implementing classes. +Example: Java 8 added default methods to List, Map without breaking old code. + +Static methods → Provide utility methods directly in the interface instead of external utility classes. +Example: Comparator.comparing(...) is a static method in Comparator interface. + +4️⃣ Example with Both: +@FunctionalInterface +public interface Calculator { + int calculate(int a, int b); + + // Default method + default void showType() { + System.out.println("This is a Calculator FI"); + } + + // Static method + static void info() { + System.out.println("Functional Interface for calculations"); + } +} + +public class Main { + public static void main(String[] args) { + Calculator add = (a, b) -> a + b; + + System.out.println(add.calculate(5, 3)); // 8 + add.showType(); // default method + Calculator.info(); // static method + } +} +✅ Still a valid Functional Interface because only 1 abstract method exists. + +5️⃣ Interview-Ready Answer ✍️: +A Functional Interface can have default and static methods because they are not abstract. +Default methods allow adding new behavior without breaking existing implementations. +Static methods provide utility/helper functionality inside the interface itself. +Since the rule is only “one abstract method,” these do not violate the definition of a Functional Interface. +============================================================================================================= +Q73. Java 8 features ? +Ans: +1️⃣ Lambda Expressions: +Enables writing functions in a concise way. +Allows behavior to be passed as data. +Works with Functional Interfaces (interfaces with a single abstract method). +Example: +List list = Arrays.asList("A", "B", "C"); +list.forEach(s -> System.out.println(s)); // Lambda expression + +2️⃣ Functional Interfaces: +An interface with exactly one abstract method (SAM – Single Abstract Method). +Can still have default and static methods. +Annotated with @FunctionalInterface. +Examples: Runnable, Callable, Comparator, Predicate, Consumer. + +3️⃣ Default and Static Methods in Interfaces +Interfaces can now have concrete methods using default keyword. +Also allow static utility methods inside interfaces. +Example: +interface MyInterface { + default void show() { System.out.println("Default method"); } + static void info() { System.out.println("Static method"); } +} + +4️⃣ Streams API: +Process collections in a functional style. +Supports operations like map, filter, reduce, collect. +Can work in parallel (multi-core optimization). +Example: +List numbers = Arrays.asList(1,2,3,4,5); +int sum = numbers.stream() + .filter(n -> n % 2 == 1) + .mapToInt(n -> n) + .sum(); +System.out.println(sum); // 9 (1+3+5) + +5️⃣ Method References +Shorter way of writing Lambdas when you just call a method. +Syntax: ClassName::methodName. +Example: +list.forEach(System.out::println); // Instead of (s -> System.out.println(s)) + +6️⃣ Optional Class +A container object to avoid NullPointerException. +Helps handle null values in a functional way. +Example: +Optional name = Optinal.ofNullable(null); + +7️⃣ Date and Time API (java.time package): +New, modern, immutable, and thread-safe Date-Time API. +Replaces old java.util.Date and Calendar. +Example: +LocalDate tody = LocalDate.now(); +LocalTime time = LocalTime.now(); +LocalDateTime dateTime = LocalDateTime.now(); + +8️⃣ Nashorn JavaScript Engine: +Execute JavaScript code inside Java applications. +Replaced old Rhino engine. +Example: +ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn"); +engine.eval("print('Hello from js')"); + +9️⃣ CompletableFuture & Concurrency Updates: +CompletableFuture introduced for asynchronous programming. +Handles non-blocking operations better than Future. +Example: +CompletableFuture.supplyAsync(()->"Hello") + .thenAccept(System.out::println); + +🔟 Other Small but Useful Features: +Base64 Encoding/Decoding API +Parallel Array Sorting → Arrays.parallelSort() +Collectors in Streams → Collectors.toList(), Collectors.groupingBy() +New Annotations → @Repeatable + +PermGen removal → replaced with Metaspace: +1️⃣ What was PermGen? +PermGen (Permanent Generation) was a special memory area in the JVM heap (till Java 7). +It stored class metadata, interned Strings, static variables, and method code. +Size was fixed at JVM startup (-XX:PermSize, -XX:MaxPermSize). + +⚠️ Problems with PermGen: +Fixed size → easily caused java.lang.OutOfMemoryError: PermGen space. +Especially in applications that load/unload many classes (e.g., web apps, Tomcat redeploys). +Tuning was difficult since different apps needed different amounts of metadata space. +Strings and class metadata being in heap caused GC inefficiency. + +2️⃣ What is Metaspace? (Java 8 onwards) + +Metaspace replaced PermGen in Java 8. +It stores class metadata just like PermGen. +Difference → Metaspace is allocated in native memory (outside the JVM heap), not inside the fixed-size heap. + +⚙️ Key Points about Metaspace: +Grows dynamically depending on classes loaded. +By default, only limited by available system memory. +Configurable with: +-XX:MetaspaceSize → initial size. +-XX:MaxMetaspaceSize → maximum limit (optional). + +3️⃣ Why replace PermGen with Metaspace? +✅ Reasons for Replacement: +Remove fixed-size limitation → no more PermGen OutOfMemoryError unless you restrict MaxMetaspaceSize. +Better GC performance → separates class metadata from heap, reduces GC overhead. +Simpler tuning → Metaspace can expand automatically, no need to pre-calculate PermGen size. +More reliable redeployments → in servers like Tomcat, JBoss, etc., classloader leaks caused PermGen OOM. Metaspace avoids that by using native memory. + +4️⃣ Example: Configuring Metaspace: +# Initial Metaspace size = 64MB +-XX:MetaspaceSize=64M + +# Max Metaspace size = 256MB +-XX:MaxMetaspaceSize=256M +If not set, it grows until OS memory limit is reached. +We can set this values like : +1. If running with java -jar +java -XX:MetaspaceSize=64M -XX:MaxMetaspaceSize=256M -jar myapp.jar + +2. In an IDE (Eclipse / IntelliJ) +Go to Run Configurations → your application → Arguments / VM Options. +Add: +-XX:MetaspaceSize=64M +-XX:MaxMetaspaceSize=256M +3. In a Spring Boot Application (Maven/Gradle run) +Maven: +mvn spring-boot:run -Dspring-boot.run.jvmArguments="-XX:MetaspaceSize=64M -XX:MaxMetaspaceSize=256M" + +4. On Tomcat / Web Servers: +If you’re deploying a .war to Tomcat, JBoss, WebLogic, etc., you set these in the server startup script: +Linux: CATALINA_OPTS or JAVA_OPTS in catalina.sh +Windows: setenv.bat or Tomcat service config +Example: export CATALINA_OPTS="$CATALINA_OPTS -XX:MetaspaceSize=64M -XX:MaxMetaspaceSize=256M" + +5. Docker / Kubernetes +Example : docker file +CMD ["java", "-XX:MetaspaceSize=64M", "-XX:MaxMetaspaceSize=256M", "-jar", "app.jar"] + + +5️⃣ Interview-Ready Summary ✍️ +PermGen (till Java 7): Fixed-size memory in heap for class metadata. Caused frequent OutOfMemoryError. +Metaspace (Java 8+): Replaced PermGen, uses native memory, grows dynamically, fewer tuning issues. +Reason for change: To eliminate PermGen OOMs, improve GC efficiency, and simplify memory management. + + +✅ Quick Interview-Ready Answer +Java 8 introduced several key features: +Lambda Expressions +Functional Interfaces +Default & Static Methods in Interfaces +Streams API +Method References +Optional Class +New Date/Time API (java.time) +Nashorn JavaScript Engine +CompletableFuture (Concurrency) +Other improvements: Base64, parallel sort, collectors, repeatable annotations, Metaspace. + +======================================================================================================== +Q74. Which class is giving default ascending order ? +Ans : TreeMap , Treeset +======================================================================================================= +Q75. How to create Spring boot project +Ans: using STS or Spring initailizer . +======================================================================================================= +Q76. What is the output ? +class A{ +void show(){ +System.out.println("A"); +} +} +class B extends A{ + void show(){ + System.out.println("B"); + } +} + +class C extends B{ + void show(){ + System.out.println("B"); + } + public static void main(String args[]){ + A a = new A(); // it will work fine + B b = new B(); //it will work fine + C c = new B(); //it will give compile time exception + A a = new C(); //it will work fine + } +} + +🔹 Line by Line Explanation +1)A a = new A(); +✅ Valid. Reference type A, object type A. +Calls A.show() → prints A. + +2)B b = new B(); +✅ Valid. Reference type B, object type B. +Calls B.show() → prints B. + +3)C c = new B(); +❌ Compile-time error: +You’re trying to assign a B object to a reference of type C. +Rule: You can assign a child object to a parent reference, but not the other way around. +B is not guaranteed to have all properties of C. +Compiler error: incompatible types: B cannot be converted to C. + +4)A a2 = new C(); +✅ Valid. Reference type A, object type C. +This is upcasting (child → parent). Always allowed. +But method resolution follows runtime polymorphism: +a2.show(); → prints C (not A), because actual object is C. + +🔑 Key Rules to Remember +1)Upcasting (Child → Parent): Allowed +Parent p = new Child(); + +2)Downcasting (Parent → Child): Not allowed without explicit cast. +Child c = new Parent(); // ❌ Compile error +Child c = (Child) new Parent(); // ❌ Runtime ClassCastException + +3)Method calls are resolved at runtime (Dynamic Method Dispatch). +======================================================================================================== +Q77. What is fetchtype in Hibernate ? +Ans : +FetchType is an enumeration in Hibernate and JPA that determines how related entities are loaded from the database — either eagerly or lazily. +🔹 Types of FetchType +1. FetchType.EAGER (Immediate Loading) +Loads the associated entity immediately along with the parent. +Causes join queries and more database load upfront. +@OneToMany(fetch = FetchType.EAGER) +private List orders; + +2. FetchType.LAZY (Lazy Loading) +Loads the associated entity only when it's accessed (on-demand). +Reduces initial load and improves performance. + +@OneToMany(fetch = FetchType.LAZY) +private List orders; + +🔸 Default FetchType by Relationship +| Relationship Type | Default FetchType | +| ----------------- | ----------------- | +| `@OneToOne` | `EAGER` | +| `@ManyToOne` | `EAGER` | +| `@OneToMany` | `LAZY` | +| `@ManyToMany` | `LAZY` | +========================================================================================================== +Q78. What is polymorphism ? +Ans:The word Polymorphism comes from Greek: +👉 Poly = many, Morph = forms +So Polymorphism means "many forms". +In Java, polymorphism allows one entity (method/object) to behave in multiple ways, depending on the context. +Types of Polymorphism in Java +A) Compile-time Polymorphism (Static Binding / Method Overloading) + +Achieved by method overloading or operator overloading (though Java doesn’t support user-defined operator overloading). +Decision made at compile time which method to call. +Example: +class Calculator { + int add(int a, int b) { + return a + b; + } + + double add(double a, double b) { + return a + b; + } +} + +public class Main { + public static void main(String[] args) { + Calculator c = new Calculator(); + System.out.println(c.add(5, 3)); // calls int version + System.out.println(c.add(2.5, 3.7)); // calls double version + } +} +B) Runtime Polymorphism (Dynamic Binding / Method Overriding) + +Achieved by method overriding + upcasting. +Decision made at runtime which method to call. +Example : +class Animal { + void sound() { + System.out.println("Animal makes a sound"); + } +} + +class Dog extends Animal { + void sound() { + System.out.println("Dog barks"); + } +} + +class Cat extends Animal { + void sound() { + System.out.println("Cat meows"); + } +} + +public class Main { + public static void main(String[] args) { + Animal a; + + a = new Dog(); + a.sound(); // Dog barks + + a = new Cat(); + a.sound(); // Cat meows + } +} +Why is Polymorphism Important? + +✅ Increases flexibility and reusability of code. +✅ Enables loose coupling (e.g., using interfaces/abstract classes). +✅ Helps in extensibility — new classes can be added with minimal changes. + +========================================================================================================== +Q79. Diff between util date & Java 8 DateAndTime? +Ans: +🔹 java.util.Date (Pre-Java 8) +Part of old date-time API (since Java 1.0). +Represents date + time in milliseconds from Jan 1, 1970 UTC (epoch). +Mutable → once created, you can modify it (thread-unsafe). +Limited methods, and most are deprecated (like getYear(), getMonth()). +Formatting & parsing requires SimpleDateFormat (not thread-safe). +Time-zone handling is clumsy. + +Example: +import java.util.Date; + +public class Main { + public static void main(String[] args) { + Date date = new Date(); + System.out.println(date); // Sat Sep 28 10:32:10 IST 2025 + } +} + +🔹 Java 8 Date and Time API (java.time package) +Introduced in Java 8 → inspired by Joda-Time library. +Main classes: +LocalDate → date only (yyyy-MM-dd) +LocalTime → time only (HH:mm:ss) +LocalDateTime → date + time (without timezone) +ZonedDateTime → date + time + timezone +Instant → machine time (timestamp from epoch) +Period / Duration → represents difference between dates/times + +✨ Features: +Immutable and thread-safe +Clear separation: Date vs Time vs DateTime vs Timezone +Better parsing/formatting with DateTimeFormatter +Supports ISO 8601 standard +Rich methods: easy to add/subtract days, months, hours, etc. +Example: +import java.time.*; +public class Main { + public static void main(String[] args) { + LocalDate date = LocalDate.now(); // 2025-09-28 + LocalTime time = LocalTime.now(); // 10:35:12.123 + LocalDateTime dateTime = LocalDateTime.now(); // 2025-09-28T10:35:12.123 + ZonedDateTime zoned = ZonedDateTime.now(); // with timezone + + System.out.println(date); + System.out.println(time); + System.out.println(dateTime); + System.out.println(zoned); + } +} +🔑 Differences: java.util.Date vs Java 8 java.time +| Aspect | `java.util.Date` (Old) | `java.time` (Java 8) | +| ------------------ | ------------------------------------- | --------------------------------------------------------- | +| **Package** | `java.util` | `java.time` | +| **Mutability** | Mutable (not thread-safe) | Immutable (thread-safe) | +| **Representation** | Milliseconds since epoch | Clear classes (`LocalDate`, `LocalTime`, `Instant`, etc.) | +| **Readability** | Confusing (e.g., months start from 0) | Intuitive (months start from 1, human-readable) | +| **Time zone** | Poor support (needs `Calendar`) | First-class support (`ZonedDateTime`) | +| **Formatting** | `SimpleDateFormat` (not thread-safe) | `DateTimeFormatter` (thread-safe) | +| **Ease of use** | Limited, lots of deprecated methods | Rich API with fluent methods | +| **Thread safety** | ❌ No | ✅ Yes | +| **Preferred?** | ❌ Legacy | ✅ Modern | + +========================================================================================================= + +**********************Integra Microservice****************************************** +Q80. What is @SpringBootApplication annotation? +Ans: The @SpringBootApplication annotation is a convenience annotation in Spring Boot that combines three key annotations into one. It is used to bootstrap and configure a Spring Boot application. +✅ It Combines: +@Configuration +@EnableAutoConfiguration +@ComponentScan +🔹 @Configuration +Marks the class as a source of bean definitions for the application context (same as in Spring Framework). It is like defining beans in XML, but using Java code. +🔹 @EnableAutoConfiguration +Tells Spring Boot to automatically configure your application based on the dependencies on the classpath. +Example: If spring-boot-starter-web is on the classpath, it auto-configures embedded Tomcat and Spring MVC. +🔹 @ComponentScan +Tells Spring to scan the current package and sub-packages for components (@Component, @Service, @Repository, @Controller, etc.), and register them as beans. +============================================================================================================== +Q81. What is Redux in React JS? +Q82. What is Context in React JS ? +Q83. What is Functional Component in React Js? +Q84. How to consume Rest API in React JS? +Q85. How to Route in React JS ? +Q86. How to validate in HTML ? +Q87. How to Deploy application in AWS ? +Q88. What is EC2 instance in AWS ? +============================================================================================================= +Q89. What is Final class in Java ? +Ans:A final class in Java is a class that cannot be extended (inherited) by any other class. + +🔒 Key Characteristics: +No Inheritance Allowed: +You cannot create a subclass of a final class. +Trying to extend it will cause a compile-time error. +Used for Security and Immutability: +Often used to create immutable classes (e.g., String class in Java). +Also used to prevent overriding of critical logic. +✅ Use Cases: +When you want to prevent inheritance for security or design reasons. +To create immutable classes (with all fields final, and no setters). +For utility/helper classes that contain only static methods. +🔍 Common Final Classes in Java: +java.lang.String +java.lang.Math +java.lang.System +=================================================================================================================== +Q90. Differnce between Spring & Spring Boot ? +Ans: +| Feature | **Spring Framework** | **Spring Boot** | +| ---------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------- | +| 🔧 **Setup & Configuration** | Manual (XML or Java-based) | Auto Configuration (Convention over configuration) | +| 📁 **Project Structure** | You set everything: dispatcher, web.xml, application context | Embedded defaults (Tomcat, Jetty, properties, etc.) | +| 🚀 **Startup Time** | Slower due to manual setup | Faster due to auto-configuration | +| 🛠️ **Dependencies** | Must manually add and configure dependencies | Auto-manages most dependencies via **starters** | +| 🌐 **Web Server** | Needs to be configured separately | Comes with embedded servers like **Tomcat**, **Jetty** | +| 👨‍🔧 **Boilerplate Code** | More boilerplate required | Minimal boilerplate | +| 🔍 **Annotations** | Uses annotations like `@Component`, `@Autowired`, etc. | Uses everything in Spring, plus adds `@SpringBootApplication` | +| 📦 **Packaging** | WAR by default | Supports **JAR** with embedded server (easy deployment) | +| 📊 **Monitoring** | No built-in monitoring | Built-in **Actuator** for monitoring and health checks | +| 🧪 **Testing** | Manual setup needed | Comes with test support & defaults | +========================================================================================================================= +Q91. What is @ComponentScan annotation ? +Ans: +The @ComponentScan annotation is used in Spring to tell the framework where to look for components, such as: +@Component +@Service +@Repository +@Controller +🔍 Purpose: +It enables automatic detection of Spring components in the specified packages so that Spring can register them in the application context. +========================================================================================================================== +Q92. can we use try block with finally ? +Ans:Yes, in Java you can use a try block with only a finally block — even without a catch block. +public class TryFinallyExample { + public static void main(String[] args) { + try { + System.out.println("Inside try block"); + int result = 10 / 2; // No exception + } finally { + System.out.println("Inside finally block"); + } + } +} +====================================================================================================================== +Q93. Checked Exception vs Unchecked Exception ? +Ans: +✅ 1. Checked Exceptions +➤ Definition: Exceptions that are checked at compile-time. The compiler ensures you either catch them or declare them using throws. +👉 In Java, Checked exceptions are exceptions that are checked at compile time (e.g., IOException, SQLException) and represent recoverable conditions. The compiler forces you to handle them using try-catch or throws. +➤ Examples: +a. IOException +b. SQLException +c. ClassNotFoundException +d. FileNotFoundException +✅ 2. Unchecked Exceptions: +👉 Unchecked exceptions are not checked at compile time (e.g., NullPointerException, ArithmeticException) and represent programming errors; they occur at runtime and handling them is optional. +➤ Definition: Exceptions that are not checked at compile-time. They are typically due to programming logic errors. +➤ Examples: +a. NullPointerException +b. ArithmeticException +c. ArrayIndexOutOfBoundsException +d. IllegalArgumentException +========================================================================================================================== +Q94.What is @Autowired annotation ? +Ans :@Autowired is a Spring Dependency Injection (DI) annotation used to automatically wire beans (i.e., inject dependencies) in a Spring application. + +✅ Purpose: +To automatically inject a bean from the Spring container into another bean without using new keyword. +✅ Example: +@Component +public class StudentService { + public void enroll() { + System.out.println("Enrolled"); + } +} + +@Component +public class StudentController { + + @Autowired + private StudentService studentService; + + public void enrollStudent() { + studentService.enroll(); // Dependency is auto-wired + } +} +➡️ StudentService will be injected into StudentController by Spring at runtime. +✅ Where can you use @Autowired? +| Location | Example | +| --------------- | --------------------------------------------- | +| **Field** | `@Autowired private MyService s;` | +| **Constructor** | `@Autowired public MyController(MyService s)` | +| **Setter** | `@Autowired public void setService(...)` | + +✅ Constructor Injection (Recommended): +@Component +public class OrderController { + private final OrderService orderService; + + @Autowired + public OrderController(OrderService orderService) { + this.orderService = orderService; + } +} +✅ Important Notes: +Works only if the class is managed by Spring container (i.e., annotated with @Component, @Service, @Repository, etc.). +If multiple beans are available, use @Qualifier to avoid ambiguity. +You can also use @Autowired(required = false) to make it optional. +✅ Under the Hood: +Spring uses Reflection + Proxy + ApplicationContext to resolve and inject the dependencies. +Car car = new Car(); // tightly coupled, hard to test +@Autowired +Car car; // Spring will inject the Car bean automatically +=============================================================================================================== +Q95. Singletone vs Prototype in spring ? + +Ans :Spring supports multiple bean scopes, and the two most commonly used are: +1️⃣ Singleton Scope (Default) +Only one instance of the bean is created per Spring container. +The same instance is reused every time it is injected or accessed. +@Component +@Scope("singleton") // or omit, as singleton is default +public class MySingletonBean { + public MySingletonBean() { + System.out.println("Singleton Bean Created"); + } +} +➡️ When you request this bean multiple times, Spring returns the same object. +2️⃣ Prototype Scope +A new instance is created every time the bean is requested from the container. +Spring creates the object but does not manage its full lifecycle after injection. +@Component +@Scope("prototype") +public class MyPrototypeBean { + public MyPrototypeBean() { + System.out.println("Prototype Bean Created"); + } +} +➡️ Each time you inject or fetch this bean, a new instance is created. +🔍 Summary Table: +| Feature | Singleton | Prototype | +| -------------------- | ------------------------------- | ------------------------------- | +| **Scope** | 1 instance per Spring container | 1 instance per request | +| **Default?** | Yes | No | +| **Object Lifecycle** | Fully managed by Spring | Only created, not fully managed | +| **Use Case** | Stateless beans, Services | Stateful beans, Custom logic | +--------------------------------------------------------------------------------------------- +================================================================================================ +Q96. what is Bean life cycle in spring ? +Ans :The Spring Bean Life Cycle refers to the sequence of steps that Spring follows from creating a bean to destroying it. +🌀 Full Lifecycle Phases: +.Instantiation +.Populate Properties (Dependency Injection) +.BeanNameAware +.BeanFactoryAware +.ApplicationContextAware +.Pre-initialization (BeanPostProcessor – before init) +.Custom Init Method (@PostConstruct or init-method) +.Post-initialization (BeanPostProcessor – after init) +.Ready to Use +.Custom Destroy Method (@PreDestroy or destroy-method) +📊 Diagram: +Instantiation ➝ Dependency Injection ➝ Aware Interfaces ➝ +BeanPostProcessor (before init) ➝ Initialization ➝ +BeanPostProcessor (after init) ➝ Ready ➝ +Destruction +🧩 Example Code +@Component +public class MyBean implements InitializingBean, DisposableBean { + + public MyBean() { + System.out.println("1. Bean is instantiated"); + } + + @PostConstruct + public void postConstruct() { + System.out.println("2. @PostConstruct - init method"); + } + + @Override + public void afterPropertiesSet() { + System.out.println("3. afterPropertiesSet() - from InitializingBean"); + } + + @PreDestroy + public void preDestroy() { + System.out.println("4. @PreDestroy - before bean destruction"); + } + + @Override + public void destroy() { + System.out.println("5. destroy() - from DisposableBean"); + } +} +🧠 Key Interfaces: +| Interface | Purpose | +| ------------------------- | --------------------------------------- | +| `InitializingBean` | Runs after properties are set | +| `DisposableBean` | Runs before bean is destroyed | +| `BeanPostProcessor` | Modify bean before/after initialization | +| `BeanNameAware` | Gets the bean name | +| `ApplicationContextAware` | Gets the application context | +🧼 Destroying Beans +Spring destroys beans only if they are singleton-scoped and registered in the context. +To enable destroy lifecycle methods: +@PreDestroy +public void cleanUp() { + // cleanup code +} +======================================================================================================= +Q97. Agregassion vs Association VS Composition ? +Ans: +| Feature | Association | Aggregation | Composition | +| ------------------ | ------------------------------------------ | --------------------------------------- | ----------------------------------------- | +| **Definition** | A general relationship between two classes | A "Has-A" relationship (weak ownership) | A "Has-A" relationship (strong ownership) | +| **Type** | Loose coupling | Partial (shared) ownership | Strong (exclusive) ownership | +| **Lifespan** | Independent | Child can exist without parent | Child cannot exist without parent | +| **Example** | Teacher ↔ Student | Department ↔ Professors | House ↔ Rooms | +| **Code Direction** | Bidirectional/Unidirectional | Unidirectional | Unidirectional | +| **Dependency** | Low | Medium | High | +🔹 1. Association +A general connection between two classes. +No lifecycle dependency. +class Student { + String name; +} +class Teacher { + String name; + List students; // associated +} +🔸 2. Aggregation (HAS-A, but shared) +A special form of Association where child can exist independently of the parent. +class Professor { + String name; +} +class Department { + List professors; // Aggregation +} +➡️ Professors can exist even if Department is deleted. +🔷 3. Composition (HAS-A, but strong) +A special form of Aggregation with strong ownership. +If parent is destroyed, child is also destroyed. +class Room { + String roomNumber; +} +class House { + List rooms = new ArrayList<>(); // Composition +} +➡️ Room cannot exist without House. +💡 Real-world analogy: +| Relationship | Real Example | +| ------------ | ----------------------------------------------- | +| Association | Doctor ↔ Patient | +| Aggregation | Library ↔ Books (books can exist elsewhere) | +| Composition | Human ↔ Heart (heart cannot live without human) | +============================================================================================================================ +******************************Citius Tech****************************************************** +Q98. Agregassion vs Association VS Composition ? +Ans: Above +=============================================================================================================== +Q99. what is SOLID Principle ? +Ans:🧱 SOLID Stands for: +| Principle | Name | Description | +| --------- | ------------------------------- | -------------------------------------------------------------------------- | +| **S** | Single Responsibility Principle | A class should have **only one reason to change**. | +| **O** | Open/Closed Principle | Classes should be **open for extension**, but **closed for modification**. | +| **L** | Liskov Substitution Principle | Subclasses should be **substitutable** for their base class. | +| **I** | Interface Segregation Principle | Clients should not be forced to depend on **interfaces they don’t use**. | +| **D** | Dependency Inversion Principle | Depend on **abstractions**, not on concretions. | +1. ✅ S - Single Responsibility Principle (SRP) +🚫 Bad: +class UserService { + public void saveUser(User user) { /* ... */ } + public void generateReport(User user) { /* ... */ } // wrong responsibility +} +✅ Good: +class UserService { public void saveUser(User user) { /* ... */ } } +class ReportService { public void generateReport(User user) { /* ... */ } } +2. ✅ O - Open/Closed Principle (OCP) +🚫 Bad (modifying existing logic): +class Payment { + void process(String type) { + if(type.equals("CARD")) { /*...*/ } + else if(type.equals("UPI")) { /*...*/ } + } +} +✅ Good (extending behavior): +interface Payment { void process(); } + +class CardPayment implements Payment { + public void process() { /*...*/ } +} + +class UpiPayment implements Payment { + public void process() { /*...*/ } +} +3. ✅ L - Liskov Substitution Principle (LSP) +Subtypes must be substitutable for their base types without breaking the application. +🚫 Bad: +class Bird { + void fly() {} +} + +class Ostrich extends Bird { + void fly() { throw new UnsupportedOperationException(); } +} +✅ Good: +interface Bird {} +interface FlyingBird extends Bird { void fly(); } + +class Parrot implements FlyingBird { public void fly() {} } +class Ostrich implements Bird {} +4. ✅ I - Interface Segregation Principle (ISP) +🚫 Bad: +interface Worker { + void work(); + void eat(); // not all workers eat (e.g., robots) +} +✅ Good: +interface Workable { void work(); } +interface Eatable { void eat(); } + +class HumanWorker implements Workable, Eatable { ... } +class RobotWorker implements Workable { ... } +5. ✅ D - Dependency Inversion Principle (DIP) +High-level modules should not depend on low-level modules. Both should depend on abstractions. +🚫 Bad: +class MySQLDatabase { + void connect() {} +} + +class App { + MySQLDatabase db = new MySQLDatabase(); +} +✅ Good: +interface Database { void connect(); } + +class MySQLDatabase implements Database { + public void connect() {} +} + +class App { + Database db; + + public App(Database db) { + this.db = db; + } +} +🔁 Summary Cheat Sheet: +| Principle | Goal | +| --------- | ---------------------------------------- | +| SRP | One class = One responsibility | +| OCP | Extend, don’t modify | +| LSP | Subtypes must behave like parent | +| ISP | Use small, client-specific interfaces | +| DIP | Rely on interfaces, not concrete classes | +================================================================================================= +Q100. Is A Relation Vs Has a Relation +Ans:These are two fundamental object-oriented design concepts in Java and other OOP languages. +🔹 1. "Is-A" Relationship (Inheritance) +Expressed using extends (for classes) or implements (for interfaces). +Indicates that one class is a subtype of another. +Represents inheritance — a parent-child or generalization-specialization relationship. +✅ Example: +class Animal { + void eat() { + System.out.println("This animal eats food."); + } +} + +class Dog extends Animal { + void bark() { + System.out.println("Dog barks"); + } +} +🔸 Dog is an Animal → Is-A relationship via inheritance. + +🔹 2. "Has-A" Relationship (Composition/Aggregation) +Implemented via object references. +One class contains another class as a field (property). +Represents composition (strong "has-a") or aggregation (weak "has-a"). +✅ Example: +class Engine { + void start() { + System.out.println("Engine starting..."); + } +} + +class Car { + private Engine engine; // HAS-A + + Car() { + engine = new Engine(); // Composition + } + + void startCar() { + engine.start(); + } +} +Car has an Engine → Has-A relationship via composition. +⚖️ Key Differences +| Feature | Is-A | Has-A | +| ----------------- | ------------------------------ | -------------------------------- | +| Relationship type | Inheritance | Composition or Aggregation | +| Keyword used | `extends` / `implements` | Reference as instance variable | +| Example | `Dog is an Animal` | `Car has an Engine` | +| Coupling | Tighter (Inheritance is rigid) | Looser (Composition is flexible) | +| Design Principle | Reuse via inheritance | Reuse via delegation | +💡 When to Use? +Use Is-A when: +There is a clear hierarchical relationship. +You need to override or extend behavior. + +Use Has-A when: +You want modular, loosely coupled code. +You want to reuse functionality without inheritance. +====================================================================================================================== +Q101. exicute() and submit() in Java thread ? +Ans:Both execute() and submit() are methods used to submit tasks to an ExecutorService, but they behave differently in terms of return type, exception handling, and task tracking. +🔹 execute(Runnable task) +Introduced in Executor interface. +Does not return anything. +Cannot track result or exception. +Used for fire-and-forget tasks. +✅ Example: +ExecutorService executor = Executors.newFixedThreadPool(2); +executor.execute(() -> System.out.println("Task executed")); + +🔹 submit(Runnable/Callable task) +Returns a Future object. +Can track, cancel, or retrieve the result. +If task throws an exception, you can catch it via Future.get(). +✅ Example with Runnable: +Future future = executor.submit(() -> System.out.println("Runnable task")); +future.get(); // returns null +✅ Example with Callable: +Future future = executor.submit(() -> "Callable result"); +String result = future.get(); // "Callable result" +⚖️ Key Differences +| Feature | `execute()` | `submit()` | +| ------------------ | --------------------------------- | ---------------------------------------- | +| Return type | `void` | `Future` | +| Exception handling | Uncaught; handled by thread group | Captured and rethrown via `Future.get()` | +| Task tracking | ❌ No | ✅ Yes (via `Future`) | +| Input type | `Runnable` | `Runnable` or `Callable` | +| Use case | Fire-and-forget tasks | Track result or exception | +💡 Which One to Use? +Use **execute()** when: +You don't care about the result or completion status. + +Use **submit()** when: +You want to track the task. +Need the result or handle exceptions explicitly. +=================================================================================================================================== +Q102. Inhancement of HashMap in Java 8? +Ans: +🔹 Enhancements of HashMap in Java 8 +1️⃣ Bucket Structure: From LinkedList → Balanced Tree (Red-Black Tree) +Before Java 8: +Each bucket used a linked list to store entries (in case of collisions). +If too many collisions happened (e.g., many keys with the same hash), it became O(n) for get() and put(). + +In Java 8: +If the number of items in a bucket exceeds a threshold (TREEIFY_THRESHOLD = 8), the linked list is converted into a balanced Red-Black Tree. +Lookup time improves from O(n) → O(log n) in worst-case scenarios. +👉 This makes HashMap much more efficient when handling collisions. + +2️⃣ New Constants Added +TREEIFY_THRESHOLD = 8 → If a bucket has more than 8 entries, switch from LinkedList → Tree. +UNTREEIFY_THRESHOLD = 6 → If the number of entries in a bucket falls below 6, switch back from Tree → LinkedList (saves memory). +MIN_TREEIFY_CAPACITY = 64 → Treeification happens only if the overall HashMap capacity is at least 64; otherwise, it resizes first. + +3️⃣ Better Hashing (Spread Function) +Java 8 improved the hash function to reduce collisions by spreading hash codes more uniformly. +The formula uses XOR (h ^ (h >>> 16)) to mix high and low bits. + +4️⃣ Performance Improvements +Worst-case performance improved from O(n) → O(log n) (thanks to treeification). +Memory-efficient because small buckets still use linked lists. +===================================================================================================================================== +Q103. Why HashMap internally using HashSet ? +Ans : +===================================================================================================================================== +Q104. What is custom hook in React Js +Q105. What is Record class in Java 11? +==================================================================================================================================== +Q106. Find indices of Sub String in parent String ? +Ans: +import java.util.*; +public class SubstringIndices { + public static void main(String[] args) { + String parent = "abcabcabc"; + String sub = "abc"; + + List indices = new ArrayList<>(); + int index = parent.indexOf(sub); // first occurrence + + while (index != -1) { + indices.add(index); + index = parent.indexOf(sub, index + 1); // find next occurrence + } + + System.out.println("Indices: " + indices); + } +} + +=================================================================================================================================== +Q107. What is returning groupBy in Java 8? +Ans: It is returning HashMap . +================================================================================= +Q108. Why props is immutable ? +Ans: +============================================================================================================================= +Q109. Supplier vs Consumer ? +======================================================================================================================== +Q110. +subString = "Name" +parentString = "My Name is only have First Name not Number" +Output - 3, 27 +====================================================================================================================== +Q111. How to find String index using Java ? +Ans : +public class Main { + public static void main(String[] args) { + String str = "Hello World"; + + System.out.println(str.indexOf('o')); // 4 (first 'o') + System.out.println(str.indexOf("World")); // 6 (substring) + System.out.println(str.indexOf('z')); // -1 (not found) + } +} +=============================================================================================================== +Q112. What is micreoservice Design pattern ? +Ans: +============================================================================================================= +Q113. What is Meta in hibernate ? +Ans: Hibernate does not have a direct @Meta annotation, but "meta" in Hibernate usually refers to metadata information used for customization or extensions. Let's explore what this means: +🔹 1. MetaData in Hibernate (General Meaning) +In Hibernate, metadata refers to the information about the mapping between classes and database tables, like: + +Entity name +Table name +Column names +Relationship mappings +Fetch types +Constraints +This metadata can come from: +@Entity, @Table, @Column, etc. +XML Mapping files (*.hbm.xml) +JPA annotations + +🔹 2. Using @AttributeOverride / @AssociationOverride +These annotations use metadata to override default mappings in embedded or associated classes. + +🔹 3. @org.hibernate.annotations.MetaValue +Hibernate provides a @MetaValue as part of its annotations for polymorphic associations. +Used with: +@AnyMetaDef( + idType = "long", metaType = "string", + metaValues = { + @MetaValue(targetEntity = Cat.class, value = "C"), + @MetaValue(targetEntity = Dog.class, value = "D") + } +) +This is for mapping a single column to multiple entity types (@Any mapping). +Hibernate will use the meta column value (like "C" or "D") to decide which class to map. + +🔹 4. Hibernate MetaModel +Hibernate generates a MetaModel for entities using annotation processing, which helps in: +Type-safe Criteria API +IDE auto-completion for fields + +For example: +CriteriaQuery query = builder.createQuery(User.class); +Root root = query.from(User.class); +query.select(root).where(builder.equal(root.get(User_.name), "John")); +================================================================================================= +Q114. @Query vs @NameSpaceQuery in hibernate ? +Ans: +🔸 1. @Query — (Spring Data JPA specific) +Provided by Spring Data JPA +Used to define custom JPQL, native SQL, or SpEL expressions directly on repository methods +Declared inline on a method +public interface UserRepository extends JpaRepository { + + @Query("SELECT u FROM User u WHERE u.email = ?1") + User findByEmail(String email); + + @Query(value = "SELECT * FROM users WHERE status = ?1", nativeQuery = true) + List findByStatus(String status); +} +✅ Advantages: +Easy to use +No external configuration +Can write native or JPQL queries +Supports pagination and dynamic parameters + +🔸 2. @NamedQuery — (Standard JPA / Hibernate) +Defined using @NamedQuery or @NamedNativeQuery annotations on the entity class +Query has a predefined name, and is referenced in code via that name +Useful in reusable or frequently used queries. + +@Entity +@NamedQuery(name = "User.findByName", query = "SELECT u FROM User u WHERE u.name = :name") +public class User { + // fields +} +Using it in code: +TypedQuery query = entityManager.createNamedQuery("User.findByName", User.class); +query.setParameter("name", "Niraj"); +List users = query.getResultList(); +✅ Advantages: +Reusable +Precompiled at application startup (can catch query syntax errors early) +Works well for large or shared queries +🔍 Summary Table +| Feature | `@Query` (Spring Data) | `@NamedQuery` / `@NamedNativeQuery` | +| ----------- | ---------------------------- | ----------------------------------- | +| Location | On Repository Interface | On Entity Class | +| Scope | Local to method | Global and reusable | +| Type | JPQL or Native | JPQL or Native | +| Flexibility | Very flexible | Less dynamic | +| Compilation | Runtime | Precompiled at startup | +| Use case | Quick, inline custom queries | Reusable or large shared queries | +=========================================================================================================== +Q115. What is AOP in spring boot ? +Ans: +🔹 AOP stands for Aspect-Oriented Programming. +It’s a programming paradigm that allows you to separate cross-cutting concerns (like logging, security, transactions) from your main business logic. +Spring Boot uses Spring AOP (built on top of Spring framework) to support AOP. + +🔸 Why AOP? +In real-world applications, some functionalities affect multiple modules — such as: +Logging +Security (authentication/authorization) +Transaction management +Exception handling +Caching +These are cross-cutting concerns and should not be tightly coupled with business logic. +🔸 Core Concepts in Spring AOP +| Concept | Description | +| -------------- | --------------------------------------------------------------------------- | +| **Aspect** | A module that encapsulates cross-cutting concern (e.g., LoggingAspect) | +| **Join Point** | A point during execution (e.g., method call) where an aspect can be applied | +| **Advice** | Action taken by an aspect (e.g., `@Before`, `@After`, `@Around`) | +| **Pointcut** | Expression that matches join points | +| **Weaving** | Linking aspect code with application code | +🔸 Common Advice Types +@Before – Runs before the method execution +@After – Runs after method finishes +@AfterReturning – Runs after method returns a result +@AfterThrowing – Runs after method throws an exception +@Around – Runs before and after method execution +✅ Example: Logging Aspect in Spring Boot +@Aspect +@Component +public class LoggingAspect { + + @Before("execution(* com.dev.service.*.*(..))") + public void logBeforeMethod(JoinPoint joinPoint) { + System.out.println("Calling method: " + joinPoint.getSignature().getName()); + } +} +🔸 Explanation: +@Aspect: Declares this class as an aspect. +@Before: Advice that runs before any method in com.dev.service package. +JoinPoint: Provides metadata like method name, arguments. + +🔸 How to Enable AOP +If you're using Spring Boot + spring-boot-starter dependencies, AOP is automatically enabled. +But explicitly, you can also use: +@EnableAspectJAutoProxy +=============================================================================================================== +Q117. Controlled vs Uncontrolled Component in React JS? +Q118. Why we cant call Parent Component into Child Component ? But we call Child component into parent component. +Q119. What is Higher Order Component in React JS ? + +**********************************Infosys-Contract***************************************************** +Q201. How to join table using @Query / Native SQL +Ans: +===================================================================================================================== +Q202. In Lazy loading if data is not loading and getting "Session is closed"/"Session out" exception, what is the reason? +Ans: +🔴 Reason: Lazy Initialization Exception +In Hibernate (or JPA), if you're using lazy loading, associated entities are not loaded immediately with the parent entity. They are fetched only when accessed, and this requires an open Hibernate session. +🔹 When You Get the Error +You get the error like: +org.hibernate.LazyInitializationException: could not initialize proxy - no Session +This typically occurs when: +You fetch an entity in a service/repository layer. +You close the session (usually happens automatically after the transaction ends). +Then you try to access the lazy-loaded property outside of that session (like in a controller or view layer). +✅ Example Scenario +@Entity +public class Department { + @OneToMany(mappedBy = "department", fetch = FetchType.LAZY) + private List employees; +} +// In Service +Department dept = departmentRepo.findById(1L).get(); // employees not fetched yet +// Session closes here +dept.getEmployees().size(); // 🔴 LazyInitializationException here +✔️ Solutions +| Solution | Description | +| ---------------------------------- | ----------------------------------------------------------------------------------------------------------- | +| ✅ **Use EAGER loading** | Change `fetch = FetchType.EAGER` (not recommended for large data or nested objects) | +| ✅ **Use `@Transactional`** | Ensure the method where lazy data is accessed is annotated with `@Transactional`, so the session stays open | +| ✅ **Use DTO Projections** | Fetch only required data using custom queries | +| ✅ **Use `JOIN FETCH` in JPQL/HQL** | Force Hibernate to fetch lazy relations | + +====================================================================================================== +Q203. How to read data from custom application.properties +Ans: @Value and env.getProperty("spring.data.user"); +================================================================================================= +Q204. How to group Exception is @ControllerAdvice +Ans : +@ExceptionHandler({UserNotFoundException.class, InvalidRequestException.class}) +public ResponseEntity handleUserErrors(RuntimeException ex) { + return ResponseEntity.badRequest().body("User error: " + ex.getMessage()); +} +================================================================================================== +Q205. Internal working of Set ? +Ans : +======================================================================================================== +Q206. How to create dynamic query using @Query annotation using HQL Hibernate +Ans: +🔹 1. Static Query with @Query +@Repository +public interface StudentRepository extends JpaRepository { + + // Static HQL query + @Query("SELECT s FROM Student s WHERE s.name = :name") + List findByName(@Param("name") String name); +} +🔹 2. Dynamic Queries with Optional Parameters +If you want the query to be dynamic (e.g., search by name, age, or both), you can use SpEL (Spring Expression Language) or conditional query building. +Example: Using @Query with SpEL +@Repository +public interface StudentRepository extends JpaRepository { + + @Query("SELECT s FROM Student s " + + "WHERE (:name IS NULL OR s.name = :name) " + + "AND (:age IS NULL OR s.age = :age)") + List search(@Param("name") String name, @Param("age") Integer age); +} +✅ Usage: +studentRepository.search("Niraj", null); // filters only by name +studentRepository.search(null, 25); // filters only by age +studentRepository.search("Niraj", 25); // filters by both + +🔹 3. Dynamic Queries with Native SQL +If you want to use native SQL instead of HQL: +@Repository +public interface StudentRepository extends JpaRepository { + + @Query(value = "SELECT * FROM students s " + + "WHERE (:name IS NULL OR s.name = :name) " + + "AND (:age IS NULL OR s.age = :age)", + nativeQuery = true) + List searchNative(@Param("name") String name, @Param("age") Integer age); +} + +-------------------Hexaware------------------------------------------------------------------- +Q207. find highest 5 sum of amount order of customer using sql? +Ans: Let’s assume you have two tables: + +customers (customer_id, customer_name, ...) +orders (order_id, customer_id, amount, ...) +✅ SQL Query: Top 5 Customers by Total Order Amount +SELECT + c.customer_id, + c.customer_name, + SUM(o.amount) AS total_amount +FROM customers c +JOIN orders o ON c.customer_id = o.customer_id +GROUP BY c.customer_id, c.customer_name +ORDER BY total_amount DESC +LIMIT 5; + +============================================================================= +Q208. find nth salary from Student map using java 8? +Map studentMap = new HashMap<>(); +studentMap.put(1, new Student(1, "Niraj", 5000)); +studentMap.put(2, new Student(2, "Ravi", 7000)); +studentMap.put(3, new Student(3, "Ankit", 6000)); +studentMap.put(4, new Student(4, "Pooja", 7000)); +Ans: +public static Optional findNthSalary(Map studentMap, int n) { + return studentMap.values().stream() + .map(Student::getSalary) + .distinct() + .sorted(Comparator.reverseOrder()) + .limit(n) // only consider top n + .skip(n - 1) // get the nth one + .findFirst(); +} +Q209. What is Terminal operation ? +Ans: +🔹 Terminal Operation +A terminal operation is the end of the stream pipeline. +It produces a result (like a value, collection, or side-effect) instead of returning another stream. +Once a terminal operation is executed, the stream cannot be reused. +✅ Common Terminal Operations: +1. forEach() → performs an action for each element. +List list = List.of("A", "B", "C"); +list.stream().forEach(System.out::println); +👉 Prints all elements. + +2. collect() → collects elements into a collection or map. + List numbers = List.of(1, 2, 3, 4, 5); +List evens = numbers.stream() + .filter(n -> n % 2 == 0) + .collect(Collectors.toList()); + +👉 Returns a List of even numbers. + +3. reduce() → reduces elements to a single value. +int sum = numbers.stream().reduce(0, (a, b) -> a + b); +👉 Returns the sum of all numbers. + +4. min() / max() → find minimum or maximum element. +Optional max = numbers.stream().max(Integer::compareTo); + +5. count() → counts elements. +long count = numbers.stream().count(); + +6. anyMatch() / allMatch() / noneMatch() +boolean hasEven = numbers.stream().anyMatch(n -> n % 2 == 0); + +7. findFirst() / findAny() +Optional first = numbers.stream().findFirst(); +================================================================================ +Q210. diff b/w @Primary v/s @Qualifire annotation? +Ans:🔹 1. @Primary +Used when multiple beans of the same type exist. +Marks one bean as the default bean to be injected. +Applied at the class level (@Component, @Service, @Bean). +Only one @Primary bean of a type can exist in the Spring Context. +✅ Example: +@Component +@Primary +public class MySQLDatabase implements Database { + public String getData() { + return "Data from MySQL"; + } +} + +@Component +public class OracleDatabase implements Database { + public String getData() { + return "Data from Oracle"; + } +} + +@Service +public class DataService { + private final Database database; + + @Autowired + public DataService(Database database) { // MySQLDatabase will be injected (default) + this.database = database; + } +} +🔹 2. @Qualifier +Used when you want to explicitly specify which bean to inject. +Works at injection point level (@Autowired). +Useful when multiple beans exist and you don’t want to rely on the default (@Primary). +✅ Example: +@Component("mysqlDb") +public class MySQLDatabase implements Database { + public String getData() { + return "Data from MySQL"; + } +} + +@Component("oracleDb") +public class OracleDatabase implements Database { + public String getData() { + return "Data from Oracle"; + } +} + +@Service +public class DataService { + private final Database database; + + @Autowired + public DataService(@Qualifier("oracleDb") Database database) { + this.database = database; // OracleDatabase will be injected + } +} +🔹 Comparison Table +| Feature | `@Primary` | `@Qualifier` | +| -------------- | --------------------------------------- | ---------------------------------------- | +| Usage | Declares a bean as **default** | Selects a **specific bean** | +| Scope | Class level (`@Component`, `@Bean`) | Injection point (`@Autowired`) | +| Number allowed | Only **one** per type | Multiple, used as needed | +| Flexibility | Less flexible (default only) | More flexible (explicit control) | +| Example Use | When one bean is mostly used as default | When you need a specific bean among many | +👉 Rule of Thumb: +Use @Primary when you have a most common default implementation. +Use @Qualifier when you want fine-grained control at the injection site. +================================================================================ +Q211. Sting,StringBuffer, StringBuilder +Ans: +============================================================================== +Q212. Write Singleton Class +Ans: +============================================================================ +Q213. == v/s .equals() ? +Ans: +============================================================================ +Q214. Types of Scope in spring ? +Ans: Singleton, Prototype, Session, Application , Request +=============================================================================== +Q215. LRU cache design java? +Ans: +=============================================================================== +*****************************Altimatrix********************************** +Q216. group by Dept ? +Get the employees grouped by department : +Emp: Name, Address ,salary ,departmentName +Ans: +Map> groupedByDept = list.stream().collect(Collectors.groupBy(Employee::getDepartment)); +====================================================================================================================== +Q217. count character occurance ? +String str = "devendra" +Map occur = str.chars().mapToObj(c->(char) c).collect(Collectors.groupingBy(Function.identity(),Collectors.counting()); +====================================================================================================================== +-------Its is for String -------- +List list = Arrays.asList(str); +Map map = list.stream().collect(Collectors.groupBy(Function.identity(),Collectors.counting()); + +Q218. find output. +try{ +String str=null; +str.trim(); +}catch(Exception ex){ +System.out.println("Exception Handled"); +}catch(NullPointerException ex){ // compile time Execption will come here +System.out.println("Null Pointer Exception Handled"); +} +Ans: + +================================================================================================================== +Q219. What is the use of static method and default method in Functional Interface ? +Ans: +🔹 1. Default Methods +👉 Purpose: Allow interfaces to provide a default implementation of a method so that implementing classes don’t have to override it, unless they want to. +📌 Use Cases: +Backward compatibility → Java libraries (like List, Map, Iterable) got new methods (forEach, sort) without breaking existing implementations. +Provides extensibility in interfaces without forcing all implementing classes to override new methods. + +🔹 2. Static Methods +👉 Purpose: Allow utility/helper methods to be defined inside the interface itself instead of a separate utility class. +They belong to the interface and are called using the interface name, not via an instance. +✅ Example: +📌 Use Cases: +Define helper or utility methods related to the interface. +Avoids cluttering utility classes (like Collections or Objects). +| Feature | Default Method | Static Method | +| -------------- | ------------------------------------------------------------ | ------------------------------------------------------- | +| Access | Called on **instance** | Called on **interface name** | +| Purpose | Provide **default implementation** to avoid breaking classes | Provide **utility/helper methods** related to interface | +| Overridable? | ✅ Yes, can be overridden | ❌ No, cannot be overridden | +| Introduced for | Backward compatibility & extensibility | Utility methods in interfaces | + +✅ Summary: +Default methods → provide reusable implementations inside interfaces (instance-level, overridable). +Static methods → provide utility methods tied to the interface (class-level, not overridable). +**********************************Tech Mahindra******************************************** +Q220. controlled component v/s uncontrolled component +Ans : Controlled component handled by React js , Uncontrolled Component handled by Virtual DOM + Controlled component value assign by state and onchange , Uncontrolled component value we are using ref + We can controle by React , We cant controlled +Q221. React DOM vs Virtual DOM in React js ? +Q223. How to share DATA accros application in React ? +Q224. What is redux in react js? +Q225. Class Component vs React Function ? +Q226. What is ES6 in React JS ? +Q227. What is Single Page and Multi page application ? +Q228. What is Router in React js ? +Ans: +============================================================================================ +Q229. How To Reverse Each Word Of A String In Java? +I/P : Welcome to Powerplay ! +O/P : emocleW ot yalprewoP ! +Ans: +String input = "Welcome to Powerplay"; + + String result = Arrays.stream(input.split(" ")) + .map(word -> new StringBuilder(word).reverse().toString()) + .collect(Collectors.joining(" ")); +============================================================================================== +******************************Nisum Technology**************************************************** +Q230. What is Transaction in microservices? +Ans:🔹 What is a Transaction? +A transaction is a sequence of operations performed as a single logical unit of work, which must follow ACID properties: + +Atomicity – All or nothing +Consistency – Maintain data integrity +Isolation – Concurrent transactions do not interfere +Durability – Once committed, changes are permanent +🔸 Challenge in Microservices +In monolithic systems, it's easy to wrap everything in a single DB transaction. + +In microservices, each service usually: +Has its own database +Is independently deployed +Uses different technologies +Hence, traditional ACID transactions (2PC) don’t work well across services. +✅ Types of Transactions in Microservices: + +1. 🔁 Distributed (or Global) Transactions +Uses Two-Phase Commit (2PC) protocol. +Managed by a transaction coordinator. +Not commonly used in modern microservices due to tight coupling and performance issues. + +2. ✅ Saga Pattern (Preferred) +A Saga is a sequence of local transactions. +Each local transaction: +Updates the database +Publishes an event or sends a message to trigger the next step +If one step fails, a compensating transaction is triggered to undo the previous steps. + +🔸 Types of Saga +a) Choreography – Event-based (No central coordinator) +Service A → emits Event A → Service B → Event B → Service C ... +Lightweight +Harder to track/debug +b) Orchestration – Central saga orchestrator coordinates all steps +Orchestrator → tells Service A → then Service B → etc. +Easier to manage and monitor + +✅ Example Use Case +Money Transfer (Microservices): +Service A: Debit from account +Service B: Credit to another account + +Saga: +Debit initiated → emits event +Credit service listens, processes +If credit fails → emit compensation event → debit rollback +🔐 How to Ensure Transaction Safety? +Use idempotent operations (retry-safe) +Maintain event logs +Use message brokers (Kafka, RabbitMQ) for communication +Use outbox pattern to ensure events are sent after local transactions +✅ Summary. +| Concept | Description | +| ----------------------- | ------------------------------------------ | +| Traditional Transaction | ACID, single DB, easy but not scalable | +| Saga Pattern | Sequence of local transactions with events | +| Choreography | Decentralized, event-driven | +| Orchestration | Centralized, easier to monitor/debug | +================================================================================================ +Q231. What is security group in EC2? +Ans: +🔹 What is a Security Group? +A security group is essentially a virtual firewall for your EC2 instances in AWS. +It controls inbound and outbound traffic at the instance level. +Security groups are stateful: +If you allow inbound traffic, the response is automatically allowed outbound, even if there’s no explicit outbound rule. + +🔹 Key Features +Virtual firewall → protects EC2 instances. +Instance-level security → unlike Network ACLs, which are subnet-level. +Rules-based → define which traffic is allowed; all unspecified traffic is denied by default. +Stateful → reply traffic is automatically allowed. +Can attach multiple security groups to a single EC2 instance. + +🔹 Inbound vs Outbound Rules +| Rule Type | Purpose | +| ------------ | --------------------------------------- | +| **Inbound** | Controls traffic **coming into** EC2 | +| **Outbound** | Controls traffic **going out** from EC2 | + +Q232. Find non reapitative character using java 8? +Ans: + Character result = input.chars() // IntStream of characters + .mapToObj(c -> (char) c) // Convert to Character + .collect(Collectors.groupingBy( + Function.identity(), + LinkedHashMap::new, // Maintain order + Collectors.counting() + )) + .entrySet() + .stream() + .filter(e -> e.getValue() == 1) + .map(e -> e.getKey()) + .findFirst() + .orElse(null); + + String str = "devendra"; + //1. converting String to List Of Character + char[] ch = str.toCharArray(); + List list = new ArrayList<>(); + for(Character c : ch){ + list.add(c); + } + //2. converting String to List Of Character + List list = str.char().mapToObj(c -> (char) c).collect(Collectors.toList()); + Set nonReapetiveCharacter = list.stream().collect(Collectors.toSet()) +============================================================================================================== +Q233. Count Each Character occurance using java 8? +Ans: +String str "java"; +Map eachCharacterOccur = str.chars().mapToObj(c->(char)c).collect(Collectors.groupingBy(Character::charValue,Collectors.counting())); +================================================================================================== +*********************************Capgemini 22-04-2025**************************************************** +Q234. find second highest salary using java 8 ? +Ans : SELECT DISTINCT salary FROM employees ORDER BY salary DESC LIMIT 1 OFFSET 1; + +Ans : SELECT MAX(salary) AS second_highest_salary FROM employees WHERE salary < (SELECT MAX(salary) FROM employees); +========================================================================================================= +Q235. Short salary organization wise list of employee ? +Ans : Map> shortEmpSalWithDepartment = employeeList.stream() + .sorted(Comparator.comparing(Employee::getSalary)) + .collect(Collectors.groupingBy(Employee::getDepartment)); + +============================================================================================================== +Q236. Callable vs Runnable ? +Ans : +🔹 1. Runnable +Part of java.lang package. +Represents a task that can be executed by a thread. +Cannot return a result. +Cannot throw checked exceptions. +Single method to implement: +@FunctionalInterface +public interface Runnable { + void run(); +} +Runnable task = () -> System.out.println("Task executed"); +new Thread(task).start(); + +🔹 2. Callable +Part of java.util.concurrent package. +Represents a task that returns a result and can throw exceptions. +Single method to implement: +@FunctionalInterface +public interface Callable { + V call() throws Exception; +} +✅ Example: +import java.util.concurrent.*; + +Callable task = () -> { + return 123; +}; + +ExecutorService executor = Executors.newSingleThreadExecutor(); +Future future = executor.submit(task); + +System.out.println("Result: " + future.get()); // waits for result +executor.shutdown(); + +============================================================================================================== +Q. How to create custom Checked exception and Unchecked exception ? +Ans: +🔹 1. Custom Checked Exception +Checked exceptions must be declared with throws or handled with try-catch. +Extend the Exception class. +// Custom Checked Exception +class MyCheckedException extends Exception { + public MyCheckedException(String message) { + super(message); + } +} + +// Usage +public class Main { + static void validateAge(int age) throws MyCheckedException { + if (age < 18) { + throw new MyCheckedException("Age must be >= 18"); + } + System.out.println("Age is valid"); + } + + public static void main(String[] args) { + try { + validateAge(16); + } catch (MyCheckedException e) { + System.out.println("Exception caught: " + e.getMessage()); + } + } +} + +🔹 2. Custom Unchecked Exception +Unchecked exceptions do not need to be declared or caught. +Extend RuntimeException. +Example: +// Custom Unchecked Exception +class MyUncheckedException extends RuntimeException { + public MyUncheckedException(String message) { + super(message); + } +} + +// Usage +public class Main { + static void validateBalance(int balance) { + if (balance < 0) { + throw new MyUncheckedException("Balance cannot be negative"); + } + System.out.println("Balance is valid"); + } + + public static void main(String[] args) { + validateBalance(-100); // No try-catch needed + } +} +🔹 Key Points +| Feature | Checked Exception | Unchecked Exception | +| -------------------- | ---------------------- | -------------------- | +| Parent Class | `Exception` | `RuntimeException` | +| Compile-time check | ✅ Must handle | ❌ Optional to handle | +| Usage | Recoverable conditions | Programming errors | +| Declaration required | `throws` | Not required | +✅ Interview-ready Answer : +Custom Checked Exception → Extend Exception, must be declared with throws or caught. +Custom Unchecked Exception → Extend RuntimeException, no need to declare or catch. +=============================================================================================================== +Q237. Internal working of HashMap ? +Q238. Java 8 features ? +Ans: +============================================================================================================= +Q239. way of creating thread ? +Ans: Thers is Two ways create Runnable and Thread class + +********************Accolite 26-04-2025************************************************** +Q240. hbbbubbb input and output 5 using java ? +Ans: +=========================================================================================================== +Q241.can we override default method in Java 8 ? +Ans: +Yes, you can override a default method in Java 8 interfaces. +✅ Why? +The default method is meant to provide a default implementation in an interface, but classes can override it if needed. +interface Vehicle { + default void start() { + System.out.println("Vehicle is starting"); + } +} + +class Car implements Vehicle { + @Override + public void start() { + System.out.println("Car is starting"); + } +} + +public class Test { + public static void main(String[] args) { + Vehicle car = new Car(); + car.start(); // Output: Car is starting + } +} +====================================================================================== +Q242.required code for create component using react ? + +Q243.well class in java ? +Ans: +Ah, you mean a final class in Java (sometimes people type “well class”) — I’ll explain carefully. + +🔹 What is a final class? +A final class in Java is a class that cannot be subclassed (no class can extend it). +Declared using the final keyword. +Useful for security, immutability, or preventing inheritance. +✅ Syntax: +final class Vehicle { + void display() { + System.out.println("Vehicle class method"); + } +} + +// Cannot extend a final class +// class Car extends Vehicle {} // ❌ Compilation Error +🔹 Why use a final class? + +1.Prevent Inheritance: +Avoid accidental modification of class behavior. + +2.Immutable Classes: +Classes like String, Integer are final to ensure immutability. + +3.Security Reasons: +Prevent malicious subclassing. + +🔹 Rules of final class +A final class cannot be subclassed. +All methods in a final class are implicitly final, but you can still declare methods as final explicitly. +You can create objects of a final class. + +========================================================================================= +Q244.way of pass argumet in Java main method ? +Ans: +🔹 1. Standard main method signature +public static void main(String[] args) +args is an array of String, which stores command-line arguments. +You can pass values to your program when executing it from the terminal or IDE. +🔹 2. Passing command-line arguments +public class Main { + public static void main(String[] args) { + for (int i = 0; i < args.length; i++) { + System.out.println("Arg " + i + ": " + args[i]); + } + } +} +Run from command line: java Main Niraj 25 Java +Output: +Arg 0: Niraj +Arg 1: 25 +Arg 2: Java +====================================================================================================== +Q245.How to access bean using following option ? +Ans: +1.BeanFactory +2.BeanFactoryWay +3.ApplicationContext +======================================================================================================= +Q246. What is Neo4 Database ? +Ans: This is used for Graph database. +=========================================================================================================== +Q247. 200 Http Code ? +Ans: its for OK +======================================================================================================== +Q248. Remote access in java ? RMI +Ans: +*********************************Wipro 27-04-2025****************************************** +Q249. List the number of projects each employee is involved with, including those not assigned to any projects. +Ans: +To list the number of projects each employee is involved with, including those not assigned to any projects, you can use a LEFT JOIN between the Employee table and a Project_Assignment (or equivalent) table. This ensures employees with zero project assignments are also included. +SELECT + e.emp_id, + e.emp_name, + COUNT(ep.project_id) AS project_count +FROM + employees e +LEFT JOIN + employee_project ep ON e.emp_id = ep.emp_id +GROUP BY + e.emp_id, e.emp_name +ORDER BY + project_count DESC; +====================================================================================================== +Q250. [1,[2,3],[4,[5,6]]] sum of sub list o/p 21 +Ans: +import java.util.*; +public class NestedListSum { + + public static int sumList(List list) { + int sum = 0; + + for (Object obj : list) { + if (obj instanceof Integer) { + sum += (Integer) obj; + } else if (obj instanceof List) { + sum += sumList((List) obj); // recursion + } + } + + return sum; + } + + public static void main(String[] args) { + List nestedList = Arrays.asList(1, Arrays.asList(2, 3), Arrays.asList(4, Arrays.asList(5, 6))); + int result = sumList(nestedList); + System.out.println("Sum: " + result); // Output: 21 + } +} + +====================================================================================================== +Q251. Netwwork latency in microservice ? +Ans: + +Q252. How to Debug microservices ? + +Q253. How to impliment CI/CD Pipe line ? + +Q254. Web front in CSS and Spring boot ? + +Q255. Form Conciliation in React js ? + +Q256. How to avoid cyclic dependency using Proxy pattern in spring boot ? + +Q257. Controller vs Rest Controller ? + +Q258. Java Annotations ? + +Q259. How to debug null pointer exception ? + +Q260. How to avoid bean confliction in spring boot ? using @Qualifire annotation . + +****************************Wipro 3-05-2025**************************************** +Q261. Group by depatment ? +Ans: +List list; +Employee -> id, name, deptName +output: Map; + +Map> groupEmp = list.stream().collect(Collectors.groupingBy(Employee::getDept); +============================================================================================================== +Q262. Write final class ? +Ans: +public class final Test{ + +public Test(int rollNo,String name ){ + this.rollNo = rollNo ; + this.name = name ; + +} + +public int rollNo, +public String name; + +//getters only + + +} +================================================================================================================ +Q263. Join 2 Tables ? +employee : emid , empdept , emsalary. +address : addid , street,city,emid. + +select * from employee e inner join address a on e.emid=a.emid; +============================================================================================================ +Q264. suupose you injected bean through setter and Constructor which one will execute first ? +Ans : Constructor Executes First. +========================================================================================================== +Q265. What is serialization ? how to serialization object . +Ans : Serialization is the process of converting a Java object into a byte stream, so that: + +It can be saved to a file, +Sent over a network, +Or stored in memory (like caching). we are Serializable interface for serialization. + +Deserialization is the reverse — converting the byte stream back into the original object. +=================================================================================================================== +Q267. suppose you configure 2 database oracle and sql how to disable spicific database? +Ans : using @ConditionalOnProperty(name = "db.active", havingValue = "oracle") +@Configuration +@ConditionalOnProperty(name = "db.active", havingValue = "oracle") +public class OracleDataSourceConfig { + // Bean definitions for Oracle +} + +@Configuration +@ConditionalOnProperty(name = "db.active", havingValue = "sqlserver") +public class SqlServerDataSourceConfig { + // Bean definitions for SQL Server +} +=================================================================================================================== +Q268. What is circuit breaker ? circuit breaker is a design pattern we are handling fault taulrance +Ans: +================================================================================================================== +Q269. How to 10 request in 10 second ? using rest api ? +Ans : Using Rate Limit we can impliment . +===================================================================================================================== +Q270. Calculate the sum of first 100 prime numbers and return the sum? +Ans: +================================================================================================================= +Q271. What is @Enableautoconfigration annotaion ? +Ans: @EnableAutoConfiguration is a Spring Boot annotation that tells Spring Boot to automatically configure beans in the application context based on the dependencies present in the classpath. +🔹 Where is it used? +You normally don’t add it manually because it’s already part of @SpringBootApplication: +@SpringBootApplication // internally includes @EnableAutoConfiguration +public class MyApp { + public static void main(String[] args) { + SpringApplication.run(MyApp.class, args); + } +} +@SpringBootApplication = +@Configuration +@EnableAutoConfiguration +@ComponentScan + +🔹 How it Works? +1. When the application starts, Spring Boot loads the file: +META-INF/spring.factories (Spring Boot 2.x) +META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports (Spring Boot 3.x+) +This file lists all auto-configuration classes (e.g. DataSourceAutoConfiguration, JpaRepositoriesAutoConfiguration, etc.). + +2.Based on the libraries in your classpath: +If you have spring-boot-starter-web, it auto-configures DispatcherServlet, Jackson, Embedded Tomcat. +If you have spring-boot-starter-data-jpa, it auto-configures EntityManagerFactory, DataSource, Hibernate. +If you have spring-boot-starter-security, it auto-configures BasicAuth, SecurityFilterChain. + +3.It reduces boilerplate — you don’t need to manually declare beans for common configs. + +🔹 Example: +Without @EnableAutoConfiguration +You’d have to configure things like: +@Bean +public DataSource dataSource() { + // configure database connection manually +} +With @EnableAutoConfiguration + +Just add dependency (spring-boot-starter-data-jpa) and properties in application.properties: +spring.datasource.url=jdbc:mysql://localhost:3306/test +spring.datasource.username=root +spring.datasource.password=admin +Spring Boot auto-configures DataSource for you. ✅ + +🔹 Excluding Auto-Configuration +Sometimes you don’t want Spring Boot’s defaults. You can exclude them: +@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) +public class MyApp { ... } +✅ In short: +@EnableAutoConfiguration makes Spring Boot powerful by removing boilerplate config and auto-wiring beans based on dependencies. +======================================================================================================================= +Q272. 🔹 What is @EntityScan? +Ans: +@EntityScan is a Spring Boot annotation that tells Spring where to look for JPA entity classes (@Entity annotated classes). +By default, Spring Boot will only scan for entities in the current package and its sub-packages where your @SpringBootApplication class is located. +If your entities are in different packages, you must explicitly configure the scan path using @EntityScan. + +🔹 Where do we use it? +You usually place it on your main application class (the one annotated with @SpringBootApplication): +@SpringBootApplication +@EntityScan(basePackages = "com.example.myapp.entities") +public class MyApp { + public static void main(String[] args) { + SpringApplication.run(MyApp.class, args); + } +} +✅ In short: +@EntityScan is used to manually specify the package(s) containing JPA entities, especially when they are outside the default package structure of your Spring Boot app. +Q273. How database connection internally working in JPA? +Ans:🔹 1. High-Level Flow +When you use JPA in Spring Boot: + +1.You configure DB connection details in application.properties (like URL, username, password). +2.Spring Boot auto-configures a DataSource (connection pool). +3.Hibernate (or another JPA provider) uses that DataSource to get connections. +4.When you run a query (save, findById, etc.), Hibernate: + + .Gets a connection from the pool. + .Prepares SQL. + .Executes it via JDBC. + .Maps the result back into entities. +2. Internal Components +Here’s what happens step by step: +(a) DataSource (Connection Factory) +Spring Boot creates a DataSource bean. +Usually uses a connection pool (HikariCP by default). +This is the entry point for DB connections. +👉 Example: +spring.datasource.url=jdbc:mysql://localhost:3306/mydb +spring.datasource.username=root +spring.datasource.password=admin +Spring Boot auto-creates a HikariDataSource object with these configs. +(b) EntityManagerFactory: + + JPA defines the EntityManagerFactory. + Spring Boot creates it using Hibernate as the provider. + Internally, it holds: + Connection details (via DataSource) + Metadata about entities (from @Entity) + Caching strategies + +(c) EntityManager: + + You don’t talk to DB directly. You use EntityManager. + It manages: + Persistence context (first-level cache) + Entity lifecycle (new → managed → detached → removed) + Internally, EntityManager needs a JDBC Connection to perform SQL. + +(d) Hibernate Session + + EntityManager is just a wrapper. Hibernate internally uses Session (its own API). + Session uses the DataSource to borrow a connection from the pool. + +(e) Connection Pool + + Instead of opening/closing a new connection each time (expensive), JPA relies on a pool. + Default in Spring Boot = HikariCP. + Steps: + Request for connection → get from pool. + Use it for query. + Release it → goes back to pool (not closed physically). + +(f) Transaction Manager + + Spring provides JpaTransactionManager. + Ensures: + One connection per transaction. + Commit/rollback at end. + Without a transaction, Hibernate may open a new connection for each statement (not efficient). +🔹 3. Example Flow: studentRepository.save(student) + + Spring opens a transaction (@Transactional). + EntityManager gets a connection from HikariCP. + Hibernate generates an INSERT SQL. + JDBC executes it using the connection. + Transaction commits → Hibernate flushes SQL. + Connection is released back to the pool. +🔹 4. Diagram + Your Code (Repository / EntityManager) + │ + ▼ + EntityManager (JPA API) + │ + ▼ + Hibernate Session (ORM Layer) + │ + ▼ + JDBC (PreparedStatement, ResultSet) + │ + ▼ + DataSource (HikariCP Connection Pool) + │ + ▼ + Actual Database (MySQL, PostgreSQL, etc.) + +🔹 5. Key Points + + Spring Boot AutoConfig → DataSource + JPA setup. + EntityManager → Hibernate Session → JDBC. + Connection pooling → improves performance. + Transactions → manage connection lifecycle. +======================================================================================================== +Q273. ArrayList v/s LinkedList ? +Ans: +====================================================================================== +Q274. What is Stream API ? +Ans: The Stream API was introduced in Java 8 to provide a functional, declarative way of processing data. + +🔹 What is a Stream? + + A Stream in Java is a sequence of data elements (objects) that can be processed in a pipeline of operations. + It is not a data structure — it doesn’t store data. + It works on top of collections, arrays, or I/O channels. + It lets you process data in a functional style (using map, filter, reduce, etc.). +========================================================================================= +Q275. How to Load data base connection while starting spring boot application ? +Ans: +======================================================================================== +Q276. What is API Gateway ? +Ans: +======================================================================================= +Q277. How to communicate micreoservice to each other ? +Ans : +1. Synchronous Communication (Request-Response) + . +========================================================================================== +Q278. Functional programming vs Object Oriented Programming ? +Ans: +🔹 1. Object-Oriented Programming (OOP) +OOP is a paradigm based on objects and classes. It organizes code into reusable objects that model real-world entities. + +✨ Key Features: + Encapsulation → bundle data (fields) + behavior (methods). + Inheritance → reuse code by extending classes. + Polymorphism → one interface, many implementations. + Abstraction → hide implementation details. + +🔹 2. Functional Programming (FP) +FP is a paradigm based on functions as first-class citizens. It emphasizes what to do rather than how to do it. + +✨ Key Features: + Pure functions → no side effects (same input → same output). + Immutability → data cannot be changed after creation. + Higher-order functions → functions can be passed/returned like variables. + Declarative style → express logic without explicit control flow. +✅ In short: +OOP → Organizes code using objects & classes. +FP → Organizes code using functions & immutability. +Java combines both → you can design a class structure (OOP) and process data using Streams & lambdas (FP). +======================================================================================== + +----------------------Wipro 2nd round ----------------------- +Q279. How to avoid duplicate message in Kafka ? +Ans : +✅ 1. Enable Idempotence on Producer +Kafka producer supports idempotence which avoids resending the same message multiple times in case of retries. +Properties props = new Properties(); +props.put("enable.idempotence", "true"); // Important! +✅ 2. Use a Unique Key for Messages +Kafka deduplicates messages only at the application level, so you can send messages with a unique key (like a UUID or transaction ID). +ProducerRecord record = new ProducerRecord<>("topic", "orderId-123", "order data"); +Then on the consumer side, ignore records with duplicate keys. +✅ 3. Use Exactly-Once Semantics (EOS) with Kafka Streams +If you're using Kafka Streams, it supports EOS: +properties.put(StreamsConfig.PROCESSING_GUARANTEE_CONFIG, StreamsConfig.EXACTLY_ONCE_V2); +✅ 4. Store Processed Message IDs +On the consumer side, keep track of processed message IDs in: +A cache (e.g., Redis or local LRU) +A database (e.g., transaction table) +An in-memory Set (for short-living apps) +if (!processedMessageIds.contains(msgId)) { + process(msg); + processedMessageIds.add(msgId); +} +✅ 5. Transactional Producer (Advanced) +Kafka producers can send messages to multiple partitions atomically: +props.put("transactional.id", "my-transactional-id"); +producer.initTransactions(); +producer.beginTransaction(); +producer.send(record); +producer.commitTransaction(); +Summary Table: +| Strategy | Prevents Duplicates | Where | Comments | +| ------------------------- | ------------------- | ------------------- | -------------------- | +| Idempotent Producer | ✅ Yes | Producer | Best for retries | +| Message Key Deduplication | ✅ Yes | Consumer | App logic | +| Kafka Streams EOS | ✅ Yes | Stream API | Full EOS | +| Store Processed IDs | ✅ Yes | Consumer | Scalable with DB | +| Transactional Producer | ✅ Yes | Producer + Consumer | Complex but powerful | +================================================================================================================ +Q280. What is Two face commite ? +Ans: +Q281. What is Transactional ? +Q282. How to improve perfromance of Spring boot application ? +Ans: +🔹 Ways to Improve Performance of a Spring Boot Application +1️. Database Performance: +✅ Connection Pooling → Use HikariCP (default in Spring Boot, very fast). +spring.datasource.hikari.maximum-pool-size=20 +spring.datasource.hikari.minimum-idle=5 +spring.datasource.hikari.idle-timeout=30000 +spring.datasource.hikari.max-lifetime=1800000 + +✅ Batch Inserts/Updates with Hibernate: + spring.jpa.properties.hibernate.jdbc.batch_size=50 + spring.jpa.properties.hibernate.order_inserts=true + spring.jpa.properties.hibernate.order_updates=true + +✅ Use Indexes in DB for frequently queried columns. +✅ Use Pagination instead of fetching all records: + Page findByName(String name, Pageable pageable); +✅ Use DTO projections instead of fetching full entity if not required. + +2️. Caching +.Use Spring Cache with Redis, EhCache, or Caffeine: +@Cacheable("students") +public Student getStudentById(Long id) { ... } +.Cache expensive queries or computations. + +3.Reduce Startup Time + .Disable unused auto-configurations: + @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class }) + + .Use Lazy Initialization: + spring.main.lazy-initialization=true +4.Optimize Hibernate/JPA + + ✅ Use fetch type = LAZY (default for collections). + ✅ Avoid N+1 problem using JOIN FETCH or @EntityGraph. + @Query("SELECT s FROM Student s JOIN FETCH s.courses WHERE s.id = :id") + Student findByIdWithCourses(Long id); + + ✅ Use read-only transactions for queries: + @Transactional(readOnly = true) + public List getAllStudents() { ... } +5. Profiling and Monitoring + + Enable Actuator for health & metrics: + Use Micrometer + Prometheus + Grafana for monitoring. + Use Spring Boot DevTools only in dev, not in prod. +6.Memory & JVM Tuning + Set proper Heap Size: + java -Xms512m -Xmx1024m -jar app.jar + + Use G1GC or ZGC for better garbage collection: + java -XX:+UseG1GC -jar app.jar +7.Asynchronous & Parallel Processing + + Use @Async for non-blocking tasks: + @Async + public CompletableFuture processFile(File file) { ... } + Use Spring WebFlux (Reactive) for high concurrent requests. + Use Message Queues (Kafka, RabbitMQ) for heavy async tasks. + +8.REST API Optimizations + + ✅ Enable GZIP Compression: + server.compression.enabled=true + server.compression.mime-types=application/json,application/xml,text/html,text/plain + ✅ Use HTTP/2 for faster communication. + ✅ Avoid unnecessary JSON fields using DTOs or @JsonIgnore. + +================================================================================================================== +Q283. If you uploading csv file and its stuck than how to kill or handle it ? +Q284. count occurance and print duplicate ? +Ans: +class Main { + public static void main(String[] args) { + + List list = Arrays.asList(10,20,20,30); + Map map = list.stream().collect(Collectors.groupingBy(Function.identity(),Collectors.counting())); + //print duplicates + map.entrySet().stream().filter(entry->entry.getValue()>1) + .forEach((entry)->{ + System.out.println(entry.getKey()+" : "+entry.getValue()); + }); + } +} +========================================================================================= +Q285. If one service is down and after up all data should be communicate to another service 2 how to handle it ? +Ans : using Kafla messaging ? +=============================================================================================================== +Q286. if one object is processing then how to handle second object proceesing confliction ? +Ans: +1.Synchronized Block (Single JVM) +If you’re running in one JVM (single instance), you can use Java’s synchronized keyword or ReentrantLock: +class Processor { + private final Object lock = new Object(); + + public void process(Object obj) { + synchronized (lock) { + System.out.println(Thread.currentThread().getName() + " is processing " + obj); + try { Thread.sleep(2000); } catch (InterruptedException e) {} + } + } +} +2. +====================================================================================================================== +Q287. How to breake singleton class ? +Ans: +1️. Using Reflection: +Reflection can bypass private constructor and create a new instance. +import java.lang.reflect.Constructor; + +class Singleton { + private static final Singleton instance = new Singleton(); + private Singleton() {} + public static Singleton getInstance() { + return instance; + } +} + +public class BreakSingletonReflection { + public static void main(String[] args) throws Exception { + Singleton s1 = Singleton.getInstance(); + + Constructor constructor = Singleton.class.getDeclaredConstructor(); + constructor.setAccessible(true); + Singleton s2 = constructor.newInstance(); + + System.out.println(s1 == s2); // false → Singleton broken + } +} + +2️. Using Cloning: +If Singleton implements Cloneable, clone() can create a new object. +class SingletonClone implements Cloneable { + private static final SingletonClone instance = new SingletonClone(); + private SingletonClone() {} + public static SingletonClone getInstance() { return instance; } + + @Override + protected Object clone() throws CloneNotSupportedException { + return super.clone(); // breaks singleton + } +} + +public class BreakSingletonCloning { + public static void main(String[] args) throws Exception { + SingletonClone s1 = SingletonClone.getInstance(); + SingletonClone s2 = (SingletonClone) s1.clone(); + + System.out.println(s1 == s2); // false + } +} +3️. Using Serialization/Deserialization: +Serialization can create a new instance while deserializing. +import java.io.*; + +class SingletonSer implements Serializable { + private static final SingletonSer instance = new SingletonSer(); + private SingletonSer() {} + public static SingletonSer getInstance() { return instance; } +} + +public class BreakSingletonSerialization { + public static void main(String[] args) throws Exception { + SingletonSer s1 = SingletonSer.getInstance(); + + // Serialize + ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("obj.ser")); + oos.writeObject(s1); + oos.close(); + + // Deserialize + ObjectInputStream ois = new ObjectInputStream(new FileInputStream("obj.ser")); + SingletonSer s2 = (SingletonSer) ois.readObject(); + + System.out.println(s1 == s2); // false → broken + } +} +4️. Using Multiple Class Loaders: +If the same Singleton class is loaded by different ClassLoaders, each will have its own instance. +(This usually happens in complex app servers or OSGi containers). +Q288. 🔹 How to Prevent Breaking Singleton? +Ans: +✅ Against Reflection +Throw exception in constructor if instance already exists: +private Singleton() { + if (instance != null) { + throw new RuntimeException("Use getInstance() method"); + } +} + +✅ Against Cloning +Override clone() to return the same instance: +@Override +protected Object clone() throws CloneNotSupportedException { + return instance; +} +✅ Against Serialization +Implement readResolve(): +protected Object readResolve() { + return instance; +} +✅ Best Solution → Enum Singleton (Java recommended way) +enum EnumSingleton { + INSTANCE; +} +✔ Thread-safe +✔ Serialization-safe +✔ Reflection-safe + +✅ In short: +A Singleton can be broken by Reflection, Cloning, Serialization, or ClassLoaders. +The safest way to create a Singleton in Java is Enum-based Singleton. +====================================================================================================================== +---------------Capgemini 02-05-2025--------------- +Q289. Merge Two array and find max occurence element from merged array ? +Ans: +public class MergeTwoArrayAndFindMaxOccurrenceStream { + + public static void main(String[] args) { + int[] arr1 = {1, 2, 3, 2, 5}; + int[] arr2 = {2, 5, 2, 3, 3}; + + //step 1: merge arrays into a stream + int[] merged = IntStream.concat(Arrays.stream(arr1), Arrays.stream(arr2)).toArray(); + Optional> map = Arrays.stream(merged).boxed().collect(Collectors.groupingBy(Function.identity(),Collectors.counting())) + .entrySet().stream().max(Comparator.comparing(Map.Entry::getValue)); + + System.out.println("map is : "+map); + } +====================================================================== +Q290. How to handle 2 Max priority thread in singleTone class? +Ans: +======================================================================================================= +Q291. Short salary group by organization wise list of employee ? +Ans: +class Employee { + +int id ; +String name; +String organization, +double salary; + +} + +Map salaryOrgwise = list.stream().sorted(Comparator.comparing(Employee::getSalary).collect(Collectors.gropingBy(Employee::getOrgnization)) + +======================================================================================================================================================= +Q292. Find Second highest salary +Ans : +select salary from employee order by salary desc limit 1,1; + +-------------------Einfochips---23-05-2025------------------- +Q293. What is single signin +Q294. What is Auth2 ? +Q295. How to avoid security for spicific rest api end points ? +Q296. What is HashMap colision ? +Q297. Hibernate Life cycle? +Q298. Hibernate cache ? +Q299. How to secure application.properties in spring boot ? +Q300. Where can we use thread? +Q301. What is transaction managemnt in spring boot ? +Q302. HashMap vs Concurrent HashMap? +Ans: +============================================================================================================= +Q303. What is Functional Interface ? How to achive before Java 8? +Ans : +✅ How to Achieve This Before Java 8 (Without Lambdas) +Before Java 8, you'd use an anonymous inner class: + +Greeting greet = new Greeting() { + public void sayHello(String name) { + System.out.println("Hello, " + name); + } +}; +greet.sayHello("Niraj"); +====================================================================================================== +Q304. More about AWS ,lambada function, dynamo DB , load balancing , deployment,RDS,SND,SQS,API Gateway,S3 Storage,IAM , AMI, Security Group ? +Q305. Deployment time in using jenkis ? +Q306. Transaction management and properties in spring boot ? + +-------------SmartTek21 23-05-2025-------------------------- + +Q307. Read the text file ? +Ans: +File file = "abc.text"; +ObjectInputStream ois = new FileInputStream(file); + +String[] string = ois.readFile(); + +for(String str : string){ + +if(str.contain("dev")){ + + } + + } +Q308. Clone object ? +Ans: +class Student extends Address implememnts Cloaniable{ + +private int id; +private String name; +private Address address; + +public Student(int id,String name,Adrress address){ + + this.id=id; + this.name=name; + this.address = address; + +} + +} +================================================================================== +Q309. Multiply list of Integer without multiply ? +Ans: +List list = Arrays.asList(10,-5,4,-2,20); // multiply without multiplication +List list2 = list.stream().map(n->n>=0).filter(n->n*2).collect(Collectors.toList()); +=============================================================================== +Q310. Aggregassion v/s composition ? + +Q311. Object class equals() v/s String equals() ? +Ans: +🔹 1. Object class equals() +Defined in java.lang.Object. +Default behavior: compares references (memory addresses), not values. +Equivalent to == operator. +Example: +Object o1 = new Object(); +Object o2 = new Object(); +System.out.println(o1.equals(o2)); // false → different objects +System.out.println(o1 == o2); // false → different references +System.out.println(o1.equals(o1)); // true → same reference +👉 So, equals() in Object does shallow comparison (reference equality). + +🔹 2. String class equals() +String overrides Object.equals(). +It checks the content (sequence of characters), not reference. + +Examle: +String s1 = new String("hello"); +String s2 = new String("hello"); + +System.out.println(s1 == s2); // false → different objects in heap +System.out.println(s1.equals(s2)); // true → same content +👉 So, String.equals() does deep comparison (value equality). + +🔹 3. Summary (Key Differences) +| Feature | `Object.equals()` | `String.equals()` | +| -------------------- | --------------------------------------- | ------------------------------------- | +| Defined in | `Object` class | `String` class (overrides Object) | +| Comparison type | Reference equality (memory addr) | Content equality (character sequence) | +| Example | `o1.equals(o2)` → false if diff objects | `"abc".equals("abc")` → true | +| Equivalent to `==` ? | Yes | No (because it compares values) | +---------------------------------------------------------------------------------------------------------- +================================================================================================== +Q312. Method Overriding rules ? +Ans: + +----------------------Photon-------------------------------------------- +Q313. Reverse each word of sentence ? +String str = "java application"; + +List list = Arrays.asList(str); + +List reversed = list.stream().map(word->new StringBuilder(word).reversed().toString()).collect(Collectors.toList()); +=============================================================================================================================== +Q314. Write one rest API with 3 layers ? +Ans: +@Service +class StudentServeceI{ + +@Autowired +StudentRepository repo; + + +List getAllStudent(); + +List getStundentById(List ids) + +List allStudent = repo.findAll(); + +} + + +@RestController("/student") +class StudentController { + +@Autowired +StudentServiec service ; + +@GetMapping("getStudentById/") +public ResponseEntity getStudentById(@PathVariable Integer id){ + +Student student = service.getStudentById(id); + +return ResponseEntity.of(student).ok(); + + +} + +} + +---------------------------Celsior Tech----------------------- +Q315. Query partition ? +Ans: +========================================================================== +Q316. Increment , Decrement React js ? +Ans: +=========================================================================== +Q317. departwise avg salary and emp count ? table is Employee and Department + +Ans: select avg(emp.salar),count(emp) from Employee emp inner join Department dept on emp.id = dept.id group by dep.id ; +SELECT dept.name AS department_name, COUNT(emp.id) AS employee_count, AVG(emp.salary) AS average_salary FROM Department dept LEFT JOIN + Employee emp ON emp.department_id = dept.id +GROUP BY + dept.name; + +========================================================================================== +Q318. grop the transaction by type and calculate sum of the amont ? Transaction is Entity + +class Transcaction{ +int amout ; +String type; + +} + + Ans : Map groupTrans = list.stream().collect(Collectors.groupingBy(Transcaction::getType,Collectors.summarizingDouble(Transcaction::getamount))); +=============================================================================================================================================== +Q319. What is the Idempotent Methods ? +Ans: +🔹 Meaning of Idempotent +A method is idempotent if calling it once or multiple times produces the same result and has the same effect on the server state. + +👉 In simple words: +Repeated execution = No side effects (other than the first call). +🔹 Idempotent in HTTP Methods +| HTTP Method | Idempotent? | Why | +| ----------- | ------------ | ---------------------------------------------------------------------------- | +| **GET** | ✅ Yes | Just retrieves data, no state change. Multiple calls = same result. | +| **PUT** | ✅ Yes | Updates/replaces resource. Repeated calls with same data = same final state. | +| **DELETE** | ✅ Yes | Deleting same resource again = still deleted (no new effect). | +| **HEAD** | ✅ Yes | Like GET but without body. | +| **OPTIONS** | ✅ Yes | Just returns communication options. | +| **POST** | ❌ No | Creates new resource. Multiple calls = multiple resources created. | +| **PATCH** | ❌ Usually No | Partial update, may change state differently each time. | +========================================================================================================================= +Q320. Thread Excecutor ? +Ans: +🔹 What is a Thread Executor? +Normally we create threads using Thread or Runnable. But managing threads manually is hard. +Java provides the Executor Framework (Executor, ExecutorService, Executors) to manage thread pools efficiently. +It allows you to submit tasks without worrying about thread lifecycle. + +🔹 Executor Interfaces +1.Executor → basic interface, executes Runnable tasks. +2.ExecutorService → extends Executor, provides lifecycle management (shutdown(), submit(), invokeAll()). +3.ScheduledExecutorService → allows scheduling tasks with delay or periodic execution. + +🔹 Example 1: Simple Executor +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; + +public class SimpleExecutorDemo { + public static void main(String[] args) { + Executor executor = Executors.newSingleThreadExecutor(); + + executor.execute(() -> { + System.out.println("Task executed by: " + Thread.currentThread().getName()); + }); + } +} + +🔹 Example 2: ExecutorService with Thread Pool +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class ThreadPoolDemo { + public static void main(String[] args) { + // Create a thread pool of 3 threads + ExecutorService service = Executors.newFixedThreadPool(3); + + for (int i = 1; i <= 5; i++) { + int taskId = i; + service.submit(() -> { + System.out.println("Task " + taskId + " executed by " + Thread.currentThread().getName()); + }); + } + + service.shutdown(); // stop accepting new tasks + } +} +🔹 Example 3: ScheduledExecutorService +import java.util.concurrent.*; + +public class ScheduledExecutorDemo { + public static void main(String[] args) { + ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2); + + scheduler.schedule(() -> { + System.out.println("Task executed after 3 seconds delay"); + }, 3, TimeUnit.SECONDS); + + scheduler.scheduleAtFixedRate(() -> { + System.out.println("Repeating task: " + System.currentTimeMillis()); + }, 1, 2, TimeUnit.SECONDS); + } +} +🔹 Common ThreadPool Types (via Executors) +newSingleThreadExecutor() → one thread executes all tasks. +newFixedThreadPool(n) → fixed number of threads. +newCachedThreadPool() → creates new threads as needed, reuses idle ones. +newScheduledThreadPool(n) → schedules tasks with delay or periodically. +✅ Key benefits of Executor Framework: +Efficient thread reuse → avoids creating/destroying threads repeatedly. +Easy task submission with submit() instead of manually new Thread(). +Supports advanced scheduling and future results (Future, Callable). +============================================================================================================ +Q321. How Executor + Callable + Future works together (returning results from threads)? +Ans: +🔹 Key Concepts +Runnable → no return, no checked exception. +Callable → returns a result of type V, can throw checked exceptions. +Future → represents the result of an asynchronous computation. +get() → waits for result. +isDone() → check if task finished. +cancel() → cancel task. +🔹 Example 1: Callable with ExecutorService +import java.util.concurrent.*; + +public class CallableFutureDemo { + public static void main(String[] args) { + // Create a thread pool of 2 threads + ExecutorService service = Executors.newFixedThreadPool(2); + + // Submit a Callable task + Callable task = () -> { + System.out.println("Task executed by: " + Thread.currentThread().getName()); + Thread.sleep(2000); // simulate delay + return 10 * 10; // return result + }; + + Future future = service.submit(task); + + try { + System.out.println("Waiting for result..."); + Integer result = future.get(); // blocks until result is ready + System.out.println("Result = " + result); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + + service.shutdown(); + } +} +🔹 Example 2: Multiple Callable Tasks +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.*; + +public class MultiCallableDemo { + public static void main(String[] args) { + ExecutorService service = Executors.newFixedThreadPool(3); + + List> tasks = Arrays.asList( + () -> "Task 1 executed by " + Thread.currentThread().getName(), + () -> "Task 2 executed by " + Thread.currentThread().getName(), + () -> "Task 3 executed by " + Thread.currentThread().getName() + ); + + try { + // invokeAll runs all tasks and returns futures + List> results = service.invokeAll(tasks); + + for (Future f : results) { + System.out.println(f.get()); // get results + } + } catch (Exception e) { + e.printStackTrace(); + } + + service.shutdown(); + } +} +🔹 Example 3: invokeAny (first successful result) +import java.util.Arrays; +import java.util.List; +import java.util.concurrent.*; + +public class InvokeAnyDemo { + public static void main(String[] args) { + ExecutorService service = Executors.newFixedThreadPool(3); + + List> tasks = Arrays.asList( + () -> { Thread.sleep(2000); return "Result from Task 1"; }, + () -> { Thread.sleep(1000); return "Result from Task 2"; }, + () -> { Thread.sleep(3000); return "Result from Task 3"; } + ); + + try { + String result = service.invokeAny(tasks); // returns fastest task result + System.out.println("First completed result: " + result); + } catch (Exception e) { + e.printStackTrace(); + } + + service.shutdown(); + } +} + +======================================================================================================= +Q322. What is Thread Pool ? +Ans: +🔹 Thread Pool in Java +A Thread Pool is a pool (collection) of pre-created worker threads that can be reused to execute tasks. +Instead of creating a new thread for every task (which is expensive in terms of memory & CPU), we reuse threads from the pool. + +Why Thread Pool? +Performance – Creating/destroying threads repeatedly is costly. +Resource Management – Limits the number of concurrent threads. +Reuse – Threads stay alive and execute multiple tasks. +Scalability – Prevents the system from being overloaded by too many threads. + +Example: +import java.util.concurrent.*; + +public class ScheduledPoolDemo { + public static void main(String[] args) { + ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(2); + + Runnable task = () -> + System.out.println("Running task at " + System.currentTimeMillis()); + + // Run task every 2 seconds, after initial 1-second delay + scheduler.scheduleAtFixedRate(task, 1, 2, TimeUnit.SECONDS); + } +} +=================================================================================================================== +Q323. State less vs State full ? +Ans: +Stateless vs Stateful (commonly asked in system design, REST APIs, microservices, and Java/Spring too). + +🔹 Stateless: +👉 A system/service is stateless if it does not remember any information about the client between requests. +Each request is independent and contains all necessary information. + +Example: +HTTP protocol is stateless. +Every request (GET/POST) from the client must include authentication info (like JWT, API key). +The server does not remember "who you are" after the request finishes. + +✔️ Advantages: +Scalable (any server can handle any request). +Simple (no session management needed). +Fault-tolerant (no dependency on stored session state). + +❌ Disadvantages: +Client must send data (like tokens) on every request. +Can increase payload size. + + +🔹 Stateful: +👉 A system/service is stateful if it remembers client data (state) across multiple requests. +The server stores session/state info for each client. + +Example: +Traditional web apps with HTTP Session. +After login, the server stores session info (like userId) in memory or DB. +Client only sends a session ID (like a cookie), and the server retrieves the state. + +✔️ Advantages: +Client doesn’t need to send all details every time. +Easier for maintaining workflows (shopping cart, multi-step forms). + +❌ Disadvantages: +Harder to scale (session must be shared across servers → sticky sessions or distributed cache). +More complex to manage. +Server memory usage increases. + +🔹 Quick Comparison: +| Feature | **Stateless** | **Stateful** | +| -------------------- | ---------------------------------- | ---------------------------------------- | +| **Definition** | No client info stored on server | Server stores client info (session) | +| **Example** | REST API with JWT | HTTP Session, Shopping Cart | +| **Scalability** | High | Harder (needs sticky session/DB) | +| **Performance** | Client carries extra info | Faster per request (server knows client) | +| **Failure Recovery** | Easy (any server can serve client) | Harder (session may be lost) | +-------------------------------------------------------------------------------------------------------- + +🔹 Real-world analogy: +Stateless → ATM machine: Every time you insert a card, you must re-enter PIN and transaction details. +Stateful → Restaurant waiter: Remembers your order and serves accordingly until you leave. + +👉 In Spring Boot + Microservices → We usually prefer stateless services (using JWT tokens for authentication) because they are more scalable. + +======================================================================================================== +Q324. n+1 Query problem ? +Ans: +🔹 What is the N+1 Query Problem? +Suppose you fetch a list of entities (like Students) in 1 query. +Then, for each student, you lazily fetch related data (like Courses) → this generates N extra queries. +So in total, 1 (main query) + N (child queries) = N+1 queries. +👉 Example (Hibernate / JPA): +List students = studentRepository.findAll(); +for(Student s : students) { + System.out.println(s.getCourses().size()); +} +What happens? + +First query → SELECT * FROM student (fetches all students). +Then, for each student → SELECT * FROM course WHERE student_id = ? +If there are 100 students → 1 + 100 = 101 queries 😱 + +🔹 Why is it a Problem? +Very inefficient. +Causes performance issues in production when data grows. +Known as an anti-pattern in ORM frameworks. + +🔹 How to Fix N+1 Problem? +✅ 1. Use JOIN FETCH (Hibernate/JPA): +@Query("SELECT s FROM Student s JOIN FETCH s.courses") +List findAllWithCourses(); +This fetches students + courses in a single query. + +✅ 2. Use EntityGraph: +@EntityGraph(attributePaths = "courses") +@Query("SELECT s FROM Student s") +List findAllWithCourses(); +JPA feature to eagerly load associations. + +✅ 3. Use batch_size (Hibernate setting) +hibernate.default_batch_fetch_size=10 +Instead of fetching 1-by-1, Hibernate groups queries into batches. + +✅ 4. Use DTO Projections +Fetch only the required fields in one SQL query: +@Query("SELECT new com.example.StudentDTO(s.name, c.name) + FROM Student s JOIN s.courses c") +List findAllStudentWithCourses(); + +🔹 Example +Without Fix (N+1 Problem) +SELECT * FROM student; +SELECT * FROM course WHERE student_id=1; +SELECT * FROM course WHERE student_id=2; +... +With Fix (JOIN FETCH) +SELECT s.*, c.* +FROM student s +JOIN course c ON s.id = c.student_id; + +✅ Summary: +N+1 query problem = fetching parent + children lazily causes multiple queries. +Fix = Use JOIN FETCH, EntityGraph, batch_size, or projections. +======================================================================================================== +Q325. Functional interface ? +Q326. HashMap Collision ? +Q327. What is AutoConfiguration ? +Q328. Virtual Dom in react js ? +Q329. React Hook ? +Q323. Factory vs Session Factory ? +Q324. Get vs Load in hibernate? +Q325. Lazy vs Eager in hibernate? +Q326. Outer join (left,right full outer)? +Q327. Truncate vs Delete ? +Q328. Primary Key vs Unique Key ? +Ans: +🔹 Primary Key +A Primary Key is a column (or set of columns) that uniquely identifies each row in a table. +It is the main unique identifier for records. + +✅ Rules of Primary Key: +Only one primary key per table (though it can be composite, i.e., multiple columns together). +Cannot contain NULL values. +Must contain unique values. +Automatically creates a unique clustered index (in most databases like MySQL, SQL Server). + +👉 Example: +CREATE TABLE Employee ( + emp_id INT PRIMARY KEY, -- Primary Key + name VARCHAR(100), + email VARCHAR(100) UNIQUE +); +Here, emp_id is the Primary Key → uniquely identifies each employee. + +🔹 Unique Key +A Unique Key ensures that the values in a column (or set of columns) are unique across rows. +It is not the main identifier but still enforces uniqueness. + +✅ Rules of Unique Key: +A table can have multiple unique keys. +Unlike Primary Key, Unique Key can have one NULL value (varies by database). +Creates a non-clustered unique index by default. +👉 Example: +CREATE TABLE Employee ( + emp_id INT PRIMARY KEY, + email VARCHAR(100) UNIQUE, -- Unique Key + phone VARCHAR(20) UNIQUE -- Another Unique Key +); +Here: +emp_id (Primary Key) → main identifier. +email and phone (Unique Keys) → prevent duplicate entries. + +🔹 Comparison Table: +| Feature | **Primary Key** | **Unique Key** | +| ----------------- | ------------------------- | --------------------------- | +| **Purpose** | Main identifier | Enforces uniqueness | +| **Per Table** | Only 1 (can be composite) | Multiple allowed | +| **NULL Allowed?** | ❌ No | ✅ Yes (only 1 null allowed) | +| **Duplicates?** | ❌ Not allowed | ❌ Not allowed | +| **Index Type** | Clustered (by default) | Non-clustered (by default) | +----------------------------------------------------------------------------------- +✅ Summary: +Primary Key = Main identity (mandatory, unique, not null). +Unique Key = Extra uniqueness constraints (can be multiple, allows null). +============================================================================================================== +Q329. Memory management in java ? +Ans: +============================================================================================================= +Q330. Unit test vs Mockito ? +Q331. Object feature ? +Q332. Callable interface in java ? +------------------------------Wipro------------------------------------ +Q333. How to storing null value in HashSet and Internal working of HashSet? +Ans: +======================================================================================================== +Q334. we have a list of employees. Employee object is id, Name and salary attributes. you need to find second highest salary. +Ans: +Integer secondHighest = list.stream().sorted(Compartor.comparing(Employee::getSalary,Collectors.reveseOrder()).skip(1).findFirst(); +================================================================================================== +Q335. Please find non repeat character from the String. +Ans: +String str = "This is my string"; +List list = str.chars().mapToObj(c->(char)c).collect(Collectors.toList()); +List nonReapitive = list.stream().distinct().collect(Collectors.toList()); + + +----------------------------Creospan-------------------------------- +Q336. revese String using java 8 dont use StringBuilder ? +String reversed = + Arrays.stream(input.split("")) + .collect(Collectors.collectingAndThen( + Collectors.toList(), + list -> { + Collections.reverse(list); + return String.join("", list); + } + )); +Q337. Update Employee salary 10000 who have salary 5000 and 7000 ? +Ans: +UPDATE employee SET salary = 10000 WHERE salary IN (5000, 7000); +============================================================================= +Q338. What IOC in spring ? +Ans: +============================================================================== +Q339. Type of Inject bean in spring ? + + +employee : id,name,salary,deptId; +dept : id , deptname; + +-----------------Solventek Deloite----------------------- +Q. What is builder design pattern ? +Q. Write Get Rest controller ? +Q. Below code is correct or not ? + +A{ + +void friend(){ +SOP("friend"); +} +} + +B extends A{ +void friend2(){ +SOP("friend 2"); +} +} + +A a = new B(); +a.friend2(); +Ans : friend2() method is not defined in Class A +Q. Below code is correct or not ? + +ArrayList c = new ArrayList("23",76,"45"); +c.streams.filter() +.filter(x->x/2) +Ans : we can not pass multiple values in ArrayList constructor and will get type cast exception ? + +@GetMapping("findById/{"id"}") +public ResponseEntity findById(Integer id){ + +} +Q. Merge 2 array and find unique + +int[] a = {1,2,3,4,4}; +int[] b = {5,6,7,8,8}; + +Set uniqueVal = IntStream.concat(Arrays.stream(a),Arrays.stream(b)).boxed().collect(Collectors.toSet()); +Q. Comparable vs Comparator ? +Ans : +🔸 1. Comparable (Natural Ordering) +Implemented by the class whose objects you want to sort. +Defines default (natural) sorting logic. +Has only one method: comparableTo(Employee emp); +class Employee implements Comparable { + int id; + String name; + + public int compareTo(Employee other) { + return this.id - other.id; // Sort by ID ascending + } +} +Collections.sort(empList); +🔸 2. Comparator (Custom Ordering) +Separate class or lambda that provides custom sorting logic. +Can define multiple different ways to sort. +Has method: int compare(T o1, T o2); +class NameComparator implements Comparator { + public int compare(Employee e1, Employee e2) { + return e1.name.compareTo(e2.name); + } +} +Collections.sort(employeeList, new NameComparator()); +Or using Java 8: employeeList.sort(Comparator.comparing(Employee::getName)); + +Q. SOLID ? +Q. How to enable cache in hibernate ? +-----------------------------------QualiTest----------------------- +Q. find the output +List chars = Arrays.asList("A","B"); +chars.add("C"); // modification not allowed here +System.out.println(chars); + + +Q. find the frequency of number using streams +list = Arrays.asList(1,5,6,1,2,4,5) +Map eachOccur = list.streams().collect(Collectors.groupingBy(Function.identity(),Collectors.counting())); + +Q. sort in reverse order using streams +list = Arrays.asList("car", "bike", "truck") +ArrayList reverseOrder = list.stream().sorted(Comparator.reversedOrder()).collect(Collectors.toList()); + +Q. OneToOne vs ManyToOne what is the default fetch type of both ? + +Ans : + +| Relationship Type | Default Fetch Type | +| ----------------- | ------------------ | +| `@OneToOne` | `EAGER` | +| `@ManyToOne` | `EAGER` | +| `@OneToMany` | `LAZY` | +| `@ManyToMany` | `LAZY` | + +Q. Store custom objects in TreeSet and sort + +Q. Shallo copy vs Deep Copy in java ? + +Q. @Mock vs @InjectMock ? +Q. What is partial mock ? +Q. Final class ? + +-----------------Infosys 2nd Round----------------- +public ArrayList countVowels(ArrayList strings, ArrayList intervals){} + +Q. count wovels from pair of strings list and return aonther intervals list ? +Q. Java 8 features ? +Q. Microservice design pattern ? +Q. suppose you have 2 interface A and B which is containing same method and both interface implemented by same class which interface method will override A or B method ? +interface A { + void show(); +} + +interface B { + void show(); +} + +class MyClass implements A, B { + @Override + public void show() { + System.out.println("Hello"); + } +} + +✅ Answer: +In this case, only one method is implemented in MyClass, and that implementation is valid for both interfaces. + +Since A and B both declare the same method signature, the compiler does not complain, and you are overriding both methods with a single implementation. + +There is no conflict as long as the method signatures are identical and the interfaces don’t have default implementations. + +⚠️ What if interfaces have default methods? + +interface A { + default void show() { + System.out.println("A"); + } +} + +interface B { + default void show() { + System.out.println("B"); + } +} + +class MyClass implements A, B { + @Override + public void show() { + // Must resolve conflict manually + A.super.show(); // or B.super.show() + } +} +Then Java will force you to override show() in MyClass because of the default method conflict. + +🧠 Summary + Case Behavior +Both interfaces have same abstract method No conflict. One implementation overrides both. +Both interfaces have default method Conflict. Must override and resolve manually. +One has default, one abstract No conflict. Abstract method forces you to override anyway. + +Let me know if you want a working code example for any case. + + +Q. suppose we are saving 10 value by rest api but want to save only 5 record how to avoid rest 5 ? + +Q. Sort map values ? + +Map sortByValues = map.entrySet().stream().sorted(Map.Entry.comparingByValues()) + .collect(Colletors.toMap(Map.Entry::getKey,Map.Entry::getValue,(k,v)->k,LinkedHasMap::new); + + +Q. Write funtional interface and impliment it . +@FunctionalInterface +interface Calculate { + int add(int a, int b); +} + +public class Test { + public static void main(String[] args) { + Calculate calc = (a, b) -> a + b; + int result = calc.add(10, 20); + System.out.println("Sum: " + result); // Output: Sum: 30 + } +} + +Q. Singleton class ? +Ans : there is 2 type of Erarly initialization and Lazy initialization Singleton class +it is Lazy initialization +class Singleton{ +public static Singleton instance = null; + +public static Singleton getInstance(){ +if(instance==null){ +instance = new Singleton(); + +} +return instance; + +} + +} +Q. find second max salary? +Ans: select salary from employee order by empid desc limit 1 offset 1; + +Q. what is interceptors in microservice ? +Q. avoid bean confliction ? +Q. @SpringBootApplication annotation ? +Ans : +@SpringBootApplication += +@Configuration // Marks the class as a source of bean definitions +@EnableAutoConfiguration // Enables Spring Boot's auto-configuration feature +@ComponentScan // Scans the package for Spring components + +Q. What is CAP Theorem in java? +Ans : +CAP Theorem — which is a concept from distributed systems, not specific to Java, but often comes up when building large-scale, fault-tolerant applications (e.g., microservices, databases, cloud apps). + +CAP Theorem states that a distributed system can only guarantee two out of the following three properties at the same time: + +Letter Property Meaning +C Consistency All nodes see the same data at the same time +A Availability Every request gets a (non-error) response—even if some nodes fail +P Partition Tolerance The system continues to work despite network failures between nodes +========================================================================================================= +Q. What is demon Thread in JVM ? +Ans : +🧠 Summary +Daemon Thread Purpose + +GC Thread Memory management +Finalizer Thread Finalize object cleanup +Reference Handler Thread Manages weak/soft/phantom refs +Signal Dispatcher Thread Handles OS-level signals +JIT Compiler Threads Bytecode to native compilation +Monitoring Threads JMX / Profiling / Stats +================================================================================================================= +Q. Write a java function which will accept the below input as a parameter and returns the below output. +Input : {"Banana", "Apple", "Kivi", "Banana", "Mango", "Kivi", "Orange"} +Output : {"Banana", "Kivi"} +Note: Input and Output both should be the list of strings. +List list = Arrays.asList("Banana", "Apple", "Kivi", "Banana", "Mango", "Kivi", "Orange"); + + List duplicates = list.stream() + .collect(Collectors.groupingBy(Function.identity(),Collectors.counting())) + .entrySet().stream().filter(entry->entry.getValue()>1) + .map(Map.Entry::getKey) + .collect(Collectors.toList()); + + System.out.println("duplicates : "+duplicates); + + +Q. Write a program which can take input as integer and give output as Binary format. +E.g. Input : 15 +Output : 1111 +note : without using any predefined method + +Ans : + +public static void convertNumToBinary(){ +int number = 15; +String binary = ""; + +while(number>0){ +int reminder = number%2; +binary = binary + reminder; +number = number/2; +} +System.out.print(binary) + +} + + +Q. Implement the method int[] findSum(int[] arr, int n) that takes an integer array arr and returns an array containing two elements from arr that add up to n. If there are multiple valid pairs, return only one. If no such pair exists, return the original array. + +Note: +Do not use any predefined functions to find the pair. + +Example: +Input: arr = [2, 7, 11, 15], n = 9 +Output: [2, 7] + + +***********************************NeoSOft Banglore**************************************************** +Q. get employee names sal is >50; +Ans : List empNamesSalgrt50k = list.streams().firlter(emp->emp.getSalary()>50000).map(Employee::getName).collect(Collectors.toLis()); +============================================================================================================= +Q.what is permgen in Java ? +Ans : +.PermGen (Permanent Generation) is a memory area in the Java heap used prior to Java 8. It stored metadata related to: +.Class definitions +.Method metadata +.Static variables +.Interned Strings (before Java 7) +.Annotations +===================================================================================================== +Q.How to handle Old Object in JVM ? +Ans: +================================================================================================ +Q.What is try with resource ? +Ans : +Old : +BufferedReader br = null; +try { + br = new BufferedReader(new FileReader("file.txt")); + System.out.println(br.readLine()); +} catch (IOException e) { + e.printStackTrace(); +} finally { + try { + if (br != null) br.close(); + } catch (IOException ex) { + ex.printStackTrace(); + } +} + +New : +try (BufferedReader br = new BufferedReader(new FileReader("file.txt"))) { + System.out.println(br.readLine()); +} catch (IOException e) { + e.printStackTrace(); +} +Means we can write code on try() function and it will automatically close the object . +================================================================================================ +Q.How to create our own annotation in java ? +Ans : +🔹 1. Define the Annotation +import java.lang.annotation.*; +@Target(ElementType.METHOD) // Can be METHOD, TYPE, FIELD, etc. +@Retention(RetentionPolicy.RUNTIME) // Available at runtime +@Documented +public @interface MyAnnotation { + String value() default "Default message"; +} +🔹 Explanation of Meta-Annotations +@Target → Where this annotation can be applied (e.g., method, class). +@Retention → When the annotation is available (SOURCE, CLASS, RUNTIME). +@Documented → Included in JavaDocs. +@Inherited → (Optional) lets subclasses inherit the annotation. +🔹 2. Use the Annotation +public class Demo { + @MyAnnotation("Running sayHello") + public void sayHello() { + System.out.println("Hello from sayHello()"); + } +} + +================================================================================================ +Q. How to handle 429 statuc code (multiple request) in spring rest api ? +Ans : using rate limit +=================================================================================================== +Q. What is memory management is java ? +Ans: +================================================================================================== +Q. Write sql query with having clause ? difference b/w where and having +Ans : +select count(empId),empdept as noOfEmp from employe group by empdept having deptId in(1,2,3); + +SELECT COUNT(empId) AS noOfEmp, empdept FROM employee GROUP BY empdept HAVING COUNT(empId) > 5; +====================================================================================================== +Q. How to create custom method in Repository ? +Ans : +@Repository +public interface ContactRepo extends JpaRepository { + // find the contact by user + // custom finder method + Page findByUser(User user, Pageable pageable); + + // custom query method + @Query("SELECT c FROM Contact c WHERE c.user.id = :userId") + List findByUserId(@Param("userId") String userId); + + Page findByUserAndNameContaining(User user, String namekeyword, Pageable pageable); + + Page findByUserAndEmailContaining(User user, String emailkeyword, Pageable pageable); + + Page findByUserAndPhoneNumberContaining(User user, String phonekeyword, Pageable pageable); + +} +====================================================================================================================== +Q. can we overload main method in java ? +Ans : +Yes we can overload main method in java +====================================================================================================================== +Q. Wrapper Classes in Java? +Ans : +In Java, wrapper classes are used to wrap primitive data types into objects. +This allows primitives to be used where objects are required — like in collections (e.g., List, Map) or generics. +🔹 List of Wrapper Classes: +| Primitive Type | Wrapper Class | +| -------------- | ------------- | +| `byte` | `Byte` | +| `short` | `Short` | +| `int` | `Integer` | +| `long` | `Long` | +| `float` | `Float` | +| `double` | `Double` | +| `char` | `Character` | +| `boolean` | `Boolean` | + +🔹 Why Use Wrapper Classes? +Use with collections like List, Map, etc. +Use in generics, method overloading, serialization. +Provide utility methods (like Integer.parseInt(), Boolean.valueOf()) +Allow null values, which primitives don’t. + +✅ Boxing (Primitive ➝ Object) +int a = 10; +Integer obj = Integer.valueOf(a); // Manual boxing +Integer autoBoxed = a; // Auto-boxing (Java 5+) + +✅ Unboxing (Object ➝ Primitive) +Integer obj = 20; +int b = obj.intValue(); // Manual unboxing +int autoUnboxed = obj; // Auto-unboxing + +🔹 Common Methods in Wrapper Classes: +Integer.parseInt("123") ➝ Converts string to int +Double.valueOf("12.34") ➝ Returns Double object +Boolean.parseBoolean("true") ➝ Converts to boolean +Character.isDigit('5') ➝ Checks if char is digit +======================================================================================================= +Q.What is the default value of Boolean class ? +Ans : +🔹 1. Primitive boolean +boolean flag; // default = false +🔹 2. Wrapper class Boolean +Boolean flag; // default = null +=========================================================================================================== +Q. can we call main method using interface ? +Ans : +✅ Yes, you can call a main() method using an interface in Java — but with some clarifications. +Although interfaces can’t be used to run programs directly, they can contain static methods (since Java 8), including main() +interface MyInterface { + static void main(String[] args) { + System.out.println("Main method in Interface"); + } +} +============================================================================================================ +Q.How to handle OutOfMemory issue in java ? +Ans : +Handling an OutOfMemoryError in Java requires both preventive measures and corrective action depending on where and why it's occurring. + +💥 What is OutOfMemoryError? +It means JVM ran out of memory in one of its memory areas: +Heap +Metaspace +Stack +GC Overhead +Direct memory + +✅ Common Types of OutOfMemoryError and How to Handle Them: +1. Java Heap Space +Occurs when your application uses more memory than the heap allows. + +Solutions: + +Increase heap size: + +bash +Copy +Edit +java -Xms512m -Xmx2g MyApp +Fix memory leaks (unreferenced but still retained objects). + +Use profiling tools like: + +VisualVM + +Eclipse MAT + +JProfiler + +2. GC Overhead Limit Exceeded +Occurs when too much time is spent on garbage collection and too little memory is reclaimed. + +Solutions: + +Optimize object creation. + +Increase heap size. + +Tune GC: + +bash +Copy +Edit +-XX:+UseG1GC -XX:MaxGCPauseMillis=200 +3. Metaspace OutOfMemoryError (Java 8+) +Occurs when class metadata (previously in PermGen) fills up. + +Solutions: + +Increase metaspace size: + +bash +Copy +Edit +-XX:MaxMetaspaceSize=512m +Check for excessive dynamic class loading or classloader leaks (e.g., in web apps). + +4. StackOverflowError +Occurs due to deep or infinite recursion. + +Solutions: + +Fix recursive methods. + +Increase stack size (only if necessary): + +-Xss1m +5. Direct Buffer Memory +Used in NIO (non-heap memory). + +Solutions: + +Increase direct memory: + +bash + +-XX:MaxDirectMemorySize=256m +Release unused buffers properly. + +✅ General Best Practices: +🔹 1. Use memory profilers +Identify memory leaks + +Monitor object allocations + +🔹 2. Avoid caching without limits +java + +Map cache = new HashMap<>(); // can grow endlessly +✅ Use LinkedHashMap with LRU eviction or Guava Cache. + +🔹 3. Use Weak/Soft references when needed +java + +Map> weakCache = new HashMap<>(); +🔹 4. Monitor JVM in production +Use tools like: + +JConsole + +VisualVM + +Prometheus + Grafana + +Heap dumps + +🔹 5. Use -XX:+HeapDumpOnOutOfMemoryError +To auto-generate a heap dump when OOM occurs: + +bash + +-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/path/to/dump.hprof +🛠 Example JVM Options for Production: +bash + +java -Xms512m -Xmx2g -XX:MaxMetaspaceSize=256m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=heapdump.hp +====================================================================================================================== +Q. What is the max size of heap memory ? +Ans : +🧠 What is the Maximum Heap Memory Size in Java? +The maximum heap size in Java depends on: +JVM architecture (32-bit vs 64-bit) +Operating system +Available physical memory +JVM flags + +🔹 1. 32-bit JVM +Theoretical max heap size: ~2 GB to 4 GB + +Practical limit is often 1.5–2 GB, due to address space limitations. + +🔹 2. 64-bit JVM +Supports much larger heaps — typically hundreds of gigabytes. + +Maximum limit depends on: + +Physical RAM + +OS limits + +JVM implementation (Oracle, OpenJDK, etc.) + +✅ Example: + +With 64-bit JVM and 32 GB RAM, you can set: +-Xmx28g +🔹 3. Default Heap Size +Typically: + +Initial (-Xms): 1/64 of physical RAM +Max (-Xmx): 1/4 of physical RAM + +👉 You can override both: + +java -Xms512m -Xmx4g MyApp +🔹 4. Check max heap programmatically + +public class MaxHeap { + public static void main(String[] args) { + long maxHeapSize = Runtime.getRuntime().maxMemory(); + System.out.println("Max Heap: " + maxHeapSize / (1024 * 1024) + " MB"); + } +} +🛠 Tip: Increase heap size when needed + +java -Xms1g -Xmx8g MyApp +But don’t set it too high without monitoring — it can cause longer GC pauses or memory waste. +===================================================================================================================== +Q.If increase memory size steal not working what should we do ? +Ans : +If increasing heap memory (e.g., via -Xmx) doesn't fix the issue, and your application still runs into OutOfMemoryError or performance issues, it likely indicates a deeper problem in the code or architecture, not just memory size. +✅ Here's what you should do step by step: +🔍 1. Use a Profiler / Analyzer +Use tools to inspect memory usage and detect memory leaks: + + VisualVM (free, comes with JDK) + + Eclipse MAT (Memory Analyzer Tool) + + JProfiler / YourKit + + JConsole, Flight Recorder, Java Mission Control + +Look for: + +Long-living objects + +Unused caches + +Growing collections (e.g., List, Map) not being cleared + +🔄 2. Check for Memory Leaks +Common causes: + +Static collections holding references +Listeners not removed +ThreadLocal misuse +Improper classloader unloading (especially in web apps) + +🔧 Example Leak: + + +static List cache = new ArrayList<>(); // Will grow endlessly +💾 3. Enable Heap Dump and Analyze It +Run with: + +-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=heap.hprof +Then analyze heap.hprof with Eclipse MAT to find: + +Biggest memory consumers + +Retained objects + +Leaking class loaders + +🧹 4. Tune Garbage Collector (GC) +If your app is GC-heavy or slow: + +Switch to G1GC or ZGC (for large heaps) + + +-XX:+UseG1GC +Optional tuning: + +-XX:MaxGCPauseMillis=200 +📦 5. Optimize Data Structures +Review usage of: + +HashMap, List, Set, etc. — are they overgrown? + +Use WeakReference or SoftReference where needed + +Avoid unbounded caching + +🧵 6. Check for Thread Leaks or Blocking +Too many threads → memory pressure + +Use thread dumps: jstack + +🧪 7. Stress Test / Load Test +Simulate high memory usage using tools like: + +JMeter + +Gatling + +Custom scripts + +This helps reproduce and analyze memory issues early. + +🧑‍🔧 8. As a Last Resort: Re-Architect +If the application truly needs more memory than available: + +Use microservices to break into smaller memory-isolated units + +Use off-heap storage (e.g., Redis, disk, file) + +Stream data instead of loading large datasets into memory + +🧠 Summary Table +| Issue | Solution | +| ----------------------------- | ------------------------------ | +| Still getting OOM | Profile heap, check leaks | +| GC overhead | Tune GC or reduce object churn | +| Heap dumps not helping | Use MAT or VisualVM | +| Caches growing uncontrollably | Use LRU or bounded caches | +| Huge file or data loads | Use streaming / pagination | +| Memory usage grows over time | Likely a leak — use profiler | + +Q. What is Spring AOP ? +Q. What is spring actuator ? +Q. What happened when spring boot application is starting ? + +---------------------------JSW One ---------------------------- +Q. What is the Java Memory Model (JMM)? +Q.What will be the output ? +List list = Arrays.asList("one", "two", "three"); +list.stream() + .filter(s -> { + System.out.println("Filtering: " + s); + return s.length() > 3; + }) + .findFirst(); // one , two , three + +Q. What will be the output ? + IntStream.range(1, 5).map(i -> i * i).peek(System.out::println).count(); //1,4,9,16 + +Q.Short String in a sequence ? + String input = "devendra"; + O/P : addeenrv + List soterd = input.chars().mapToObj(c->(char)c).collect(Collectors.toList()); + List listSort = soterd.stream().sorted().map(String::valueOf).collect(Collectors.toList()); + + +Q.What is strangler fig +Q.What is cap theorum +Q.What is blue green deployment +Q.Whats is the stages of jenkis +Ans : +✅ Common Jenkins Stages +| Stage Name | Purpose | +| ------------------------ | ------------------------------------------------------ | +| **Checkout** | Pulls source code from Git/SVN repository. | +| **Build** | Compiles code, installs dependencies. | +| **Test** | Runs unit, integration, or other automated tests. | +| **Package** | Packages the app into a JAR/WAR/Docker image, etc. | +| **Static Code Analysis** | Runs tools like SonarQube, Checkstyle, etc. | +| **Code Quality Gate** | Verifies quality thresholds (e.g., test coverage). | +| **Security Scan** | Runs tools like OWASP Dependency Check or Snyk. | +| **Deploy to Dev** | Deploys to development environment. | +| **Deploy to QA/UAT** | Deploys to QA/staging/test environment. | +| **Approval** | Waits for manual approval before moving to production. | +| **Deploy to Prod** | Final deployment to the production server/environment. | +| **Cleanup** | Deletes temp files, workspace, or old builds. | + + +Q. Which dependency injection is most preferd ? +Ans :✅ Constructor Injection (Most Preferred) +🔍 Why Constructor Injection is Preferred: +| Reason | Explanation | +| ------------------------------------------ | --------------------------------------------------------------------- | +| ✅ **Immutability** | You can declare dependencies as `final` — promoting immutable design. | +| ✅ **Mandatory dependencies** | Ensures required beans are provided at object creation time. | +| ✅ **Easier testing** | Easy to test with mocks or stubs via constructors. | +| ✅ **Better with frameworks** | Works well with frameworks like Spring Boot and testing tools. | +| ✅ **Avoids hidden dependencies** | All required beans are explicitly listed in the constructor. | +| ✅ **Safe for `@Autowired(required=true)`** | You can't accidentally skip required fields. | +================================================================================================================================ +Q. How to designe scalable Rest APIS ? +Ans:Designing scalable REST APIs means building APIs that can handle growing traffic, data, and users without performance degradation. Here's a step-by-step approach to designing scalable REST APIs: +✅ 1. Follow RESTful Principles +Use proper HTTP methods: GET, POST, PUT, DELETE, PATCH. +Resource naming: /users, /orders/123/items +Use stateless design – don't store session on the server. +✅ 2. Use Pagination, Filtering, Sorting +Avoid returning large data sets in a single call. +GET /users?page=2&size=50&sort=name +✅ 3. Use Caching +Use HTTP caching headers: ETag, Cache-Control, Last-Modified. +Leverage CDN or in-memory caching (e.g., Redis). +✅ 4. Asynchronous Processing +Use message queues (e.g., RabbitMQ, Kafka) for long-running tasks. +Return a 202 Accepted with a status URL: +POST /generate-report +→ 202 Accepted +Location: /reports/123/status +✅ 5. Versioning Your API :- GET /api/v1/users +✅ 6. Use Proper Status Codes +| Status Code | Meaning | +| ----------- | --------------------- | +| 200 | OK | +| 201 | Created | +| 204 | No Content | +| 400 | Bad Request | +| 404 | Not Found | +| 500 | Internal Server Error | +✅ 7. Rate Limiting & Throttling +Protect your API from abuse. +Return 429 Too Many Requests if limit is hit. + +✅ 8. Security Best Practices +Use HTTPS. +Use JWT or OAuth 2.0 for authentication. +Input validation and output sanitization. + +✅ 9. Horizontal Scalability +Ensure API can run in multiple instances (stateless). +Use load balancer (e.g., Nginx, AWS ALB) +✅ 10. Monitoring and Observability +Log all requests/responses (without sensitive data). +Use Prometheus + Grafana, Zipkin, ELK Stack, Spring Boot Actuator. +✅ 11. Use HATEOAS (optional) +Include links in responses to guide clients: +{ + "id": 1, + "name": "Niraj", + "_links": { + "self": "/users/1", + "orders": "/users/1/orders" + } +} +✅ 12. Database Optimization +Use indexing, connection pooling. +Avoid N+1 query problem (fetch joins, batching). +Example Tech Stack for Scalable APIs: +Spring Boot / Node.js +Redis for caching +PostgreSQL / MongoDB +RabbitMQ / Kafka for async processing +Docker + Kubernetes for deployment +======================================================================================================= +Q. SAGA design pattern ? +Q. Which file is most perfrence .properties or .yml in spring boot ? +Precedence Between .properties and .yml. + +Spring Boot loads both application.properties and application.yml if both are present. +The order of loading is not based on extension but on location and profile. + +If both define the same property, the last one loaded wins (overrides the previous). + +By default, application.properties and application.yml in the same folder have no explicit priority — the one loaded later overrides the other. +Best Practice +Choose one format per project for consistency. +Use .yml if you need hierarchical/nested config — easier to maintain. +Use .properties if you prefer simple flat key-value pairs. + +Quick Note on Profiles +Profile-specific files are named like: +application-dev.properties or application-dev.yml +Spring Boot merges profile-specific config on top of base config. + +-----------------------------Altimatric form Master Card--------------------------- +Q. How to secure spring boot application? +Q. suppose we have two files .properties or .yml we have different port on both file by which port application will up ? +Ans : +✅ 1. Active Profile (spring.profiles.active) +If you define: +# in application.yml +spring: + profiles: + active: dev +✅ 3. If Profiles Are Not Set +If you have: + +application.yml → server.port=8080 +application-dev.yml → server.port=9090 +❌ But spring.profiles.active=dev is not set +✅ Then only application.yml is used. +✅ Result: App runs on 8080 + + +Q. What is AutoConfig ? +Q. What is Nonsql database? +Q. Can we share database with micreoservices? +Ans : +Yes, you can share a database among microservices, but you shouldn't — at least not in most cases. + +🚫 Why You Should Avoid Sharing Databases in Microservices +Sharing a database violates the core principle of microservices: +Each microservice should be independently deployable, scalable, and maintainable. + +Q. What is event sourcing in microservice? +Ans :KAFKA + +✅ Q: What is a Microservice? +Microservice is an architectural style where an application is structured as a collection of small, independent, loosely coupled services, each responsible for a specific business capability. + +Q. HashMap v/s HashTable ? + +Q. Spring security annotaions ? + +Q. Predicates v/s Function ? + +Q. How many inbuilt Immutable class in java ? +Ans : +✅ Summary Table +| Category | Immutable Classes | +| ------------------- | ----------------------------------------------- | +| Core Lang | `String`, Wrappers (`Integer`, `Double`, etc.) | +| Math | `BigInteger`, `BigDecimal` | +| Date/Time (Java 8+) | `LocalDate`, `Instant`, `ZonedDateTime`, etc. | +| Util | `UUID`, `Currency`, `Locale`, `Pattern`, `Path` | + +Q. Regular expression for email? +Ans : + String email = "test.email@example.com"; + String regex = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"; + + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(email); + + if (matcher.matches()) { + System.out.println("Valid email"); + } else { + System.out.println("Invalid email"); + } + +Q. Spring Boot application that helps adding money to a bank account with transactional support +account entity - id, owner,balance +note:- need to first check if account id passed exists or not , then add money to account + +Q. How to add Time out feature in rest api ? +Ans : + +Q. What is the output ? +Stream stream = Arrays.asList(1,2).stream(); +stream.forEach(System.out::println); +stream.forEach(System.out::println); // It will give exception + +Q. one liner code for printing top 3 elements from above list in java +numbers = [2,1,5,8,1000,56,87,54,90,89,67.....2000,400,98....] +Ans : List top3 = numbers.stream().sorted(Comparator.reverseOrder()).limit(3).collect(Collectors.toList()); +Q. Predicate vs Function ? +Ans : + +-----------------------------------Dellote--------------------------------- +Q. filter() which type of functional interface accepting in java 8? +Ans : +filter() uses Predicate + +✅ Q. How to maintain different database connections while deploying a Spring Boot application in production? +✅ Answer: Using Profiles & Jenkins Pipeline + +Q. Virtual Machine v/s Docker container ? + +Q.What is Docker file ? +Ans : +# Step 1: Base image +FROM openjdk:17 +# Step 2: Copy JAR file into container +COPY target/myapp.jar app.jar +# Step 3: Run the application +ENTRYPOINT ["java", "-jar", "app.jar"] + +Q. Find distinct value form List of Integer? +Ans : +List distinct = list.stream().distinct().collect(Collectors.toList()); +============================================================================== +Q. String input = "hello my name is Devendra"; + output --> "Devendra is name my hello" +Ans : + String reverse = Arrays.stream(input.split(" ")) + .collect(Collectors.collectingAndThen(Collectors.toList(), list -> { + Collections.reverse(list); + return String.join(" ",list); + })); +================================================================================== +Q. If inteface has static and default method then why Abstract class is requred ? + +----------------------Dellote Second Round ----------------------- +Q. How to create docker image ? +Q. What is kubernetes ? +✅ Q. What is Load Balancing in Kubernetes? +Ans : +Load Balancing in Kubernetes refers to distributing network traffic evenly across multiple pods (application instances) to ensure: +High availability +Scalability +Better performance +Fault tolerance + +🧭 Why Do We Need Load Balancing? +Imagine your application is running in 3 pods: +If all traffic goes to just one pod, that pod can crash. +Load balancing makes sure traffic is spread across all healthy pods. +⚙️ Types of Load Balancing in Kubernetes +| Type | Purpose | +| --------------------------- | ---------------------------------------------------------------------------- | +| **Internal Load Balancing** | Balances traffic **within the cluster** (between pods) | +| **External Load Balancing** | Balances traffic **from outside** the cluster (e.g., users hitting your app) | + +Q. Vm v/s Docker ? +Q. Product flow ? + + +----------------------Synechron-----------------------================================ +Q. @PostConstruct and @PreDestroy +Ans: using @PostConstruct and @PreDestroy, which are lifecycle annotations used in Spring (or any Java EE environment) to handle initialization and cleanup logic of beans. + +✅ When to Use? +@PostConstruct: runs after dependency injection and before the bean is put into service. +@PreDestroy: runs before the bean is destroyed (e.g., when the Spring context is shutting down). + +Q. What is CLI in spring boot? +Ans : + +Q. ❓🔹What is CompletableFuture ? +Ans : CompletableFuture is part of Java 8's java.util.concurrent package. +It represents a future result of an asynchronous computation, which you can manually complete, chain, and combine. +💡 Why use CompletableFuture? +Perform tasks asynchronously (non-blocking) +Write cleaner, readable async code (instead of manually managing threads) +Combine or chain multiple asynchronous operations +Better than old Future interface (which is blocking) +Exa: +import java.util.concurrent.CompletableFuture; +public class Demo { + public static void main(String[] args) { + CompletableFuture future = CompletableFuture.supplyAsync(() -> { + // Simulate async task + return "Hello, CompletableFuture!"; + }); + future.thenAccept(result -> { + System.out.println("Result: " + result); + }); + } +} +| Method | Purpose | +| -------------------------- | --------------------------------------------------- | +| `supplyAsync(Supplier)` | Run task async and return result | +| `runAsync(Runnable)` | Run async task without returning a result | +| `thenApply(Function)` | Transform result | +| `thenAccept(Consumer)` | Consume result (no return) | +| `thenCombine(f1, f2, ...)` | Combine two futures | +| `exceptionally()` | Handle exceptions | +| `join()` / `get()` | Block and get the result (not recommended in async) | + +Q. ❓ mapStartProps vs mapDistractToProp? +Ans : This is react js question. +Q. ❓Difference between ReentrantLock and synchronized block ? +Ans : Both ReentrantLock and synchronized are used to provide mutual exclusion (i.e., only one thread can access a critical section at a time) in Java concurrency, but they have several important differences. +🔁 Quick Overview: + +| Feature | `synchronized` | `ReentrantLock` (from `java.util.concurrent.locks`) | +| -------------------------- | ------------------------ | --------------------------------------------------- | +| Simplicity | ✅ Easy to use | ❌ Slightly more complex | +| Explicit Locking | ❌ Automatic | ✅ Manual lock/unlock required | +| Try Locking (non-blocking) | ❌ Not supported | ✅ `tryLock()` method available | +| Interruptible Locking | ❌ Not possible | ✅ `lockInterruptibly()` supported | +| Fairness | ❌ No | ✅ Can create a fair lock | +| Condition Variables | ❌ Uses `wait()/notify()` | ✅ Uses `newCondition()` for fine-grained control | +| Reentrancy | ✅ Yes | ✅ Yes | +| Performance (under load) | ⚠️ May degrade | ✅ Better under high contention | +| Readability | ✅ Cleaner syntax | ❌ More verbose | +🔧 Example of synchronized: +public synchronized void printHello() { + System.out.println("Hello " + Thread.currentThread().getName()); +} +Or with block: +public void printHello() { + synchronized (this) { + System.out.println("Hello " + Thread.currentThread().getName()); + } +} +🔧 Example of ReentrantLock: +ReentrantLock lock = new ReentrantLock(); +public void printHello() { + lock.lock(); + try { + System.out.println("Hello " + Thread.currentThread().getName()); + } finally { + lock.unlock(); // Must release the lock manually + } +} + +Q. What is building blocks of react ? +Ans: Class, Components , Hooks, React Dom, Router etc +Q. Internal working of ConcurrentHashMap? +Ans : +Q. How to secure spring boot application? +Ans : using spring security. +Q. How to handle exception in spring boot? +Q. What is API gateway? +Ans : An API Gateway is a single entry point for all client requests in a microservices architecture. +It acts as a reverse proxy, routing requests to the appropriate backend services and handling common cross-cutting concerns. +🧭 Think of it like: +A traffic controller for microservices — handling who goes where and how. +🧱 Responsibilities of an API Gateway: +| Responsibility | Description | +| ---------------------------------- | ---------------------------------------------------- | +| **Routing** | Forwards requests to appropriate microservices | +| **Authentication & Authorization** | Verifies identity (e.g., JWT, OAuth2) | +| **Rate Limiting** | Prevents abuse by limiting requests | +| **Load Balancing** | Distributes traffic across service instances | +| **Caching** | Speeds up responses for common requests | +| **Logging & Monitoring** | Captures analytics and logs | +| **Transformation** | Modifies request/response formats (e.g., JSON ↔ XML) | +| **CORS handling** | Handles cross-origin request policies | +| **SSL termination** | Handles HTTPS decryption before forwarding | + + +Q. What is SAGA design pattern ? +Q. Why notify() and notifyAll() method available in object class ? +Ans : +Because every object in Java has a monitor (lock), and notify()/notifyAll() are used to coordinate threads waiting on that object's monitor — so these methods belong to the Object class, not Thread. +🔸 3. Why Not in Thread Class? +wait()/notify() coordinate access to an object’s state, not the thread's state. +If they were in Thread, it would confuse their purpose — which is to notify waiting threads on a specific object, not to control a specific thread itself. +✅ Summary +| Point | Explanation | +| --------------------------------------------- | ------------------------------------------------ | +| `notify()` and `notifyAll()` are in `Object` | Because threads wait on **objects**, not threads | +| Threads acquire object monitors | Hence, object controls when threads wake up | +| Designed for coordination via object monitors | Not for controlling thread lifecycle directly | + +Part 1: +-------- +You have a table of employees with Eid, Fname, Lname, Email, Salary etc. Write an SQL query to print names of all the employees whose salary greater than or equal to the employee with first name “Rita" + +Table Name :: Employee +Column Names :: Eid, Fname, Lname, Email, Salary + +select Fname from employee where Salary >=(select Salary from employee where Fname = 'Rita') + +Part 2: +-------- +Now assume the salary has been moved to Salary Table. Write an SQL query to print names of all the employees whose salary greater than or equal to the employee with first name “Rita”. + +Table Name :: Employee +Column Names :: Eid, Fname, Lname, Email . + +Table Name :: Salary +Column Names :: Eid, Salary + +SELECT e.Fname, e.Lname +FROM Employee e +JOIN Salary s ON e.Eid = s.Eid +WHERE s.Salary >= ( + SELECT s2.Salary + FROM Employee e2 + JOIN Salary s2 ON e2.Eid = s2.Eid + WHERE e2.Fname = 'Rita' + LIMIT 1 +); + + +Q. Write a program to print all combination of the given String. +Examples : +String (Input) : ABC, Combinations (Output): ABC, BCA, CAB, CBA, BAC, ACB +String (Input) : ABCD, Combinations (Output) : ABCD ABDC ACBD ACDB ADBC ADCB BACD BADC BCAD BCDA BDAC BDCA CABD CADB CBAD CBDA CDAB CDBA DABC DACB DBAC DBCA DCAB DCBA + +Q. Given a string, find the length of the longest substring without repeating characters. +Example: +String str = "abcabcbb"; +Answer : Length : 3 Substring : abc and bca and cab + +--------------------------------------Synechron-------------------------------------------------------------------- + +Q.int arr[] ={2,3,1,2,6,2,7,2,2} find mazority of element ? +Ans : +Map map = Arrays.stream(arr).boxed() + .collect(Collectors.groupingBy(Integer::intValue,Collectors.counting())) + .entrySet().stream().filter(e->e.getValue()>arr.length/2) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); +Q. How to communicate microservice to each other ? + +RestTemlate template = new RestTemlate("http:\\serviceA\getAll") // A +Student std= template.get(); +RestTemlate response = new RestTemlate("http:\\serviceB\get"+std) // B + +Q. Path Varibale ? +@GetMapping("getbyd/{"id"}") +public Student getById(@PathVariable int id){ + + +} + +Q. 🧱 What Are Interceptors in Java? +Ans :Interceptors in Java are used to intercept method calls or lifecycle events — allowing you to run custom logic before, after, or around business methods. + +They are part of AOP (Aspect-Oriented Programming) concepts, used widely in: +Java EE / Jakarta EE (@Interceptor) +Spring (HandlerInterceptor, MethodInterceptor) +Hibernate, JAX-RS, and custom frameworks +🔹 3. Spring AOP Interceptors (More Generic) +Can be written using @Aspect +@Aspect +@Component +public class LoggingAspect { + + @Before("execution(* com.example.service.*.*(..))") + public void logBefore(JoinPoint joinPoint) { + System.out.println("Method called: " + joinPoint.getSignature().getName()); + } +} + +Q. 🔁 What is @Retryable in Spring? +The @Retryable annotation in Spring is used to automatically retry a failed operation when an exception occurs. +It is part of the Spring Retry module and is typically used to handle transient failures, like: +Temporary network issues +Timeout errors +Remote service unavailability +Database deadlocks + +import org.springframework.retry.annotation.Retryable; +import org.springframework.stereotype.Service; +@SpringBootApplication +@EnableRetry +public class MyApp { + + } + +@Service +public class PaymentService { + + @Retryable( + value = { RemoteServiceException.class }, + maxAttempts = 3, + backoff = @Backoff(delay = 2000) + ) + public void processPayment() { + System.out.println("Trying to process payment..."); + // Simulate failure + throw new RemoteServiceException("Payment service not available"); + } +} + +Q. How to communicate spring security +@PreAuthorized(hasRoll="admin") +@EnableWebSecuirity + +Q. How Kafka working ? +Producer --- up +Consumer --- serice +@KafkaListiner(topic="",goupId = "") +class Consumer { + +KafkaTemplate temp = + +} +Q. reverse string ? +String str = "java"; +String rerverse = ""; +for(int i =str.length();i>0;i--){ + +reverse = rerverse + str.charAt(i); + +} +************************************Impetus*********************************************** +Q. +String input = "programming"; +find duplicat char + +List list = input.chars().mapToObj(c->(char)c).collect(Collectors.toList()); +Set set = new HashSet<>(); +List duplicateChar = list.stream().filter(ch->!set.add(ch)).collect(Collectors.toList()); +============================================================================================================= +Q. Give output ? +class Employee { + int id; + String name; + public Employee(int id, String name) { + this.id = id; + this.name = name; + } +} + +Map map = new HashMap<>(); +map.put(new Employee(1, "A"), "HR"); +map.put(new Employee(2, "B"), "IT"); + +System.out.println(map.get(new Employee(1, "A"))); // Output will be null because he couldnt find the key unique Key . +============================================================================================ +Q. Convert List of User to Map ? +class User { + + private String name; + private int age; + public User(String name, int age) { + this.name = name; + this.age = age; + } + public String getName() { + return name; + + } + public void setName(String name) { + this.name = name; + + } + public int getAge() { + return age; + + } + public void setAge(int age) { + this.age = age; + + } + @Override + public String toString() { + return "User{" + + "name='" + name + '\'' + + ", age=" + age + + '}'; + + } + + } + +List users = Arrays.asList( + + new User("C", 30), + new User("D", 40), + new User("A", 10), + new User("B", 20), + new User("E", 50)); + + + +map => key : age , value : name + +Q. using java 8 features +Map users = list.stream().collect(Collectors.toMap(User::getAge,User::getName)),(oldVal,newVal)->oldVal),new::LinkedHashMap)); +====================================================================================================================================== +Q. o/p -> name, dept_name if no depart print 'no department' + +Employee + +| emp_id | name | dept_id | + +| ------- | ------- | -------- | + +| 1 | Alice | 10 | + +| 2 | Bob | NULL | + +| 3 | Charlie | 20 | + +| 4 | Diana | 99 | + +Department +| dept_id | dept_name | + +| -------- | ---------- | + +| 10 | HR | + +| 20 | IT | + + +Ans : +select name,dept_name from Employee e inner join Department d on e.dept_id= d.dept_id; +SELECT e.name,COALESCE(d.dept_name, 'no department') AS dept_name FROM Employee e LEFT JOIN Department d ON e.dept_id = d.dept_id; + + +------------------Emorphis------------------------------------ +1,3,7,13,21,31,43,57,73,91 + +int arr[] = {1,3,7,13,21,31,43,57,73,91}; + + +List list = Arrays.asList(arr).boxed().collect(Collectors.toList()); + +List series = list.stream().filter(n->n%2==0) + +Q.student (id,roll_no,name,subject,marks) table find top 3 student in each subject ? +Ans : +WITH RankedStudents AS (Select id,roll_no,name,subject,marks) ROW_NUMBER() OVER(PARTION BY subject ORDER BY marks DESC) as rank FROM student) +select * FROM RankedStudents Where rank <=3 ; + +#select name,marks from student group by name,marks top 3; + +********************************Persistent******************************************* +Q. swap gender M to F and F to M in employee table query ? +Ans : +UPDATE employee +SET gender = CASE + WHEN gender = 'M' THEN 'F' + WHEN gender = 'F' THEN 'M' + ELSE gender + END; +================================================================ +Q.What is authentication server in microservices ? +Q. spring security deep +Q. Circuit breaker design pattern +Q. Kafka groping +Q. SSL , Network +Q. API Gateway which used in AWS for microservice? +Q. How to validate token while API authentication +Q. How Grafana reading logs from aws +Q. What is zipkin slauth and zull ? +Q. How to Enable SSL cerificate ? +Q. How to maintain dependency in Docker ? +Q. Image vs Container ? +Q. How to run docker images using kubernetes ? +Q. components of kubenetes ? +Q. What id Docker compose , how to run multiple docker images ? +Q. What is Centralize logging in microservices how to impliment it from aws cloudwatch to Grafana? +Q. What is Kibana? +Q. What are the replacement of docker,kubernetes , api gateway in AWS ? +Ans : +In AWS, the “container + orchestration + edge‑routing” stack you’d typically build yourself with Docker, Kubernetes, and an API Gateway can be replaced (or fully managed) by the following AWS services: + +Q. Encoing vs Encryption in spring boot ? + +*******************************CalSoft************************************* +Q. Noraml getter method vs Emoloyee :: getID? + +class Employee { + int empId; + String empName; + //settter + //getters +} + +List emName = listEmp.stream().map(Employee::getName).collect(Collectors.toList()); + +Q.Example Lambda Function +@FuntionalInterface +interface Calculator{ +int addSub(int a,int b); +} + +class Test{ + +public static void main(String args[]){ + +Calculator calc = (a,b) ->a+b; + +int sum = calc.addSub(10,20); + +Calculator calc1 = (a,b) ->a-b; + +int sub = calc1.addSub(10,20); + +} +} +======================================================================================= +Q. find second Max salary ? +int[] arr = {5,6,8,7,1}; +Ans: +List list = Arrays.stream(arr).boxed().collect(Collectors.toList()); +Integer secondMax = list.stream().sorted(Comparator.reverse()).limit(2).skip(1).findFirst(); + +========================================================================================== +Q. +try{ +Db connection creation +Connectio con = Drive +//System.exit(0); +return 10; +} catch(Exception ex){ +SYSO("Catch ") +}finally{ +if(con!=null){ +con.close(); +} +SYSO("finally ") +} + +try(){ // try with resource + +} +===================================================================== +Q. +public Employee(){ +Employee(10,20); +} + +public Employee(int s,int p){ +Employee(10); +} + +public Employee(int s){ + +} +ArithMaticException // unchecked +NullPointerException // unchecked +ArrayIndexOutOfBond()// unchecked + +FileNotFoundException() // checked + + + +OutOfMemoryError() + +Q. What is Executors ? +Q. Callable VS Runnable ? +=========================================================================================== +Q. What is Sliding Window in Circuit breaker ? +Ans : 1. COUNT-BASE + 2. TIME-BASE + +------------------------------------------------- +class Employee{ + +private int empid; +private String designation; +private double salary ; +private int age ; +private Date dateOfJoining + +} + +Q. get senior software engineer and sort by salary descending order +Ans : +List sortedWithSeniorSoftwaeEng = list.stream().filter(e->e.getDesignation().equals("SSE")) +.sorted(Comparator.comparing(Employee::getSalary).reverseOrder()).collect(Collectors.toList()); +============================================================================================================ +Q. get senior software e and sort by salary descending order , multiple emp sam salary , date sort with date also +Ans: +List sortedWithSeniorSoftwaeEng = list.stream().filter(e->e.getDesignation().equals("SSE")) +.sorted(Comparable.compare(Employee::getSalary).reverseOrder().thenComparing(Employee::getJoiningDate)).collect(Collectors.toList()); +============================================================================================================== +Q. group Employee by joining date ? +Ans: +Map> groupByDate = list.stream().collect(Collectors.groupingBy(Employee::getJoiningDate)); +============================================================================================================== +Q. Function vs procedure ? + +Q. How to create index in sql +Ans: +================================================================================= +Q. Microservices design pattern ? +Q. How to communicate microservice ? + +**************************Calsoft 2nd************************************** +For Class A with methods M1 (synchronized), M2 (synchronized), and M3 (not synchronized), and +Class B with methods M1 (static synchronized) and M2 (synchronized), + +consider the following use cases with objects A1, A2 (of Class A), and B1, B2 (of Class B): + + - Use case 1: thread1 calls A1.M1 and t2 calls B1.M2 //same + - Use case 2: thread1 calls A1.M1 and t2 calls B1.M1 // wait + - Use case 3: thread1 calls A1.M1 and t2 calls A1.M2 // same + - Use case 4: thread1 calls B1.M1 and t2 calls B1.M2 // same + +================================================================================================== +Q. class sample { + int a; + static int b; + static { + a = 5; + b = 7; + } + public sample() { + a = 10; + b = 20; + } + psv main(String [] args) { + sysout(a); + sysout(b); + } + } + + o/p compile time error becaue we are using nonstatic variable in static block +======================================================================================================= +Q. Map map = new HashMap<>(); + map.put("Key1","Key2"); + map.put("Key2","Key3"); + sysout(map.get("Key3")); +o/p : null +====================================================================================================== +Q.List down the student's details who scored more that 70 marks in 3 subjects from mechanical department? + St_details , department, marks + + pk-stdid pk-dptId pk-mid + +SELECT s.student_id, s.student_name, d.department_name FROM student s JOIN department d ON s.department_id = d.department_id JOIN marks m ON s.student_id = m.student_id WHERE d.department_name = 'Mechanical' AND m.score > 70 GROUP BY s.student_id, s.student_name, d.department_name +HAVING COUNT(m.subject) >= 3; + + +Q. Why array index is starting from zero ? +Ans : +✅ 1. Memory Address Calculation (Efficiency) +Arrays in most languages (like C, Java, etc.) are stored in contiguous memory locations. The formula to access an element at index i: +Address of element i = base_address + (i * size_of_element) +If indexing started at 1: +Address = base_address + ((i - 1) * size) +The subtraction (i - 1) would be extra computation at runtime. +So, starting from 0 makes the calculation simpler and faster. + +Q. drawback of Spring boot ? +Q. What is Scalability in spring boot ? +Ans : +Scalability in Spring Boot (or in general software architecture) refers to the ability of an application to handle increased load—either more users, more data, or more requests—without compromising performance. +🚀 Two Types of Scalability. +1. Vertical Scalability (Scale Up) +Adding more resources (CPU, RAM) to your existing machine. + +✅ Easy but has a hardware limit. +2. Horizontal Scalability (Scale Out) +Running multiple instances of your application across servers. +Spring Boot is stateless by default, which makes it ideal for this. +Best used with: +Load balancers +Containerization (Docker) +Service registry (Eureka) +Distributed configuration (Spring Cloud Config) +🧩 How Spring Boot Supports Scalability. +| Feature | How it Helps with Scalability | +| ------------------------- | ---------------------------------------------- | +| **Stateless Design** | Allows multiple instances to run independently | +| **Spring Cloud** | Tools for microservices scalability | +| **@Async** / Thread Pools | Handles concurrent tasks without blocking | +| **Caching (Redis, etc.)** | Reduces DB calls, improving performance | +| **Reactive Programming** | With WebFlux, supports millions of connections | +| **Load Balancing** | Works with Ribbon, Netflix OSS, or Kubernetes | +| **Service Discovery** | With Eureka, for dynamic service scaling | +| **Spring Boot Actuator** | Provides health/status for scaling tools | + +Q. suppose producer producing 1000 message per minute and consumer consuming it but suddenly consumer service is down for 15 minute and after producer keep producing 1000 msg per minute means 15000 msg stored and after 15 minute consumer is started now consumer how to consume huge data ? + +Q. Deploy spring boot application using docker and kubernetes ? + +Q. Kafka Implimentation real time ? + +You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjacent houses were broken into on the same night. + +Q. Why HashMap is allow only single null key ? +Ans : HashMap allows only one null key because all keys must be unique, and null is treated like any other key — but with special handling. +Because HashMap requires all keys to be unique, and there's no way to differentiate two null keys. + +Unlike normal keys which are compared using key.equals(k), you can’t call .equals() on null — it will throw a NullPointerException. +============================================================================================================================== +Q. can we use Runnable with Executors ? +Ans : Yes +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; + +public class RunnableWithExecutor { + public static void main(String[] args) { + ExecutorService executor = Executors.newFixedThreadPool(3); // 3 threads + + Runnable task = () -> { + System.out.println("Running task by: " + Thread.currentThread().getName()); + }; + + // Submit task multiple times + for (int i = 0; i < 5; i++) { + executor.execute(task); + } + + executor.shutdown(); // Always shutdown the executor + } +} +import java.util.concurrent.*; +public class CallableWithExecutor { + public static void main(String[] args) { + ExecutorService executor = Executors.newFixedThreadPool(2); + + Callable task = () -> { + Thread.sleep(1000); // Simulate long task + return "Task completed by " + Thread.currentThread().getName(); + }; + + // Submit task and get Future + Future future = executor.submit(task); + + try { + // Get the result (blocks until the task completes) + String result = future.get(); + System.out.println(result); + } catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); + } + + executor.shutdown(); + } +} + +Future future = null; +try { + future = executor.submit(task); + String result = future.get(); // This could be null if your task returns null + System.out.println("Result: " + result); +} catch (RejectedExecutionException e) { + System.err.println("Task was rejected. Executor may be shut down."); +} catch (InterruptedException | ExecutionException e) { + e.printStackTrace(); // Handle other exceptions +} +============================================================================================================= +Q. What is Bean life cycle ? +Q. What is bean factory ? +Ans: +BeanFactory is the root interface for accessing the Spring Inversion of Control (IoC) container. It is responsible for: +🧩 Creating, managing, and configuring application beans. +✅ Key Responsibilities of BeanFactory: +Instantiating beans +Wiring dependencies (DI) +Lifecycle management of beans (init, destroy) +Lazy initialization (creates beans only when requested) +📌 BeanFactory vs ApplicationContext. +| Feature | `BeanFactory` | `ApplicationContext` | +| --------------------------- | --------------------------- | ------------------------ | +| Bean instantiation | **Lazy** | **Eager by default** | +| Internationalization (i18n) | ❌ Not supported | ✅ Supported | +| Event publication | ❌ No | ✅ Yes | +| AOP integration | ❌ Basic | ✅ Full support | +| Recommended for | Low-memory or embedded apps | Most Spring applications | + +============================================================================================================ +Q. How to sort 1 lack List of employee object ? +Ans: +A. employees.sort(Comparator.comparing(Employee::getSalary)); +B. employees.sort(Comparator.comparing(Employee::getSalary).reversed()); +C. employees.sort(Comparator.comparing(Employee::getSalary).thenComparing(Employee::getName)); //Multiple filed sorting +D. List sorted = employees.parallelStream().sorted(Comparator.comparing(Employee::getSalary)).collect(Collectors.toList());//using parallelStream +============================================================================================================== +Q. How to implimnet monolithic to microservices? +Q. What is the draw back of stream api compare to Collection ? +Ans : +| **Drawback** | **Explanation** | +| ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| **One-time Use** | A Stream can be consumed only once. After terminal operation like `collect()` or `forEach()`, it is closed. Unlike Collections which can be reused. | +| **No Index-Based Access** | You can't access elements by index like `list.get(2)` in streams. | +| **No Modification** | Streams are **read-only**. You can filter/map, but **not add/remove/update** elements in the original source. Collections support modification. | +| **No Short-Circuiting After Terminal Operation** | Once you start a stream with a terminal operation like `collect()` or `forEach()`, you can't pause or revert. | +| **Harder to Debug** | Stream chains can be harder to debug because they're more abstract (e.g., hard to add breakpoints inside `map()` or `filter()`). | +| **Overhead in Simple Use-Cases** | For small datasets, using streams adds unnecessary complexity or performance overhead compared to simple `for` loop or collection methods. | +| **No Null-Safety by Default** | Streams don't handle null collections well. You get `NullPointerException` if you do `stream()` on a null list. | +| **Less Familiar to Beginners** | Functional programming model (like lambdas) can be intimidating or confusing for Java developers not used to it. | + +❌ Streams Do Not Support Index-Based Access +List names = Arrays.asList("Alice", "Bob", "Charlie"); +names.stream() + .forEach(name -> { + // We don’t have an index here! + System.out.println(name); + }); +❌ Trying to Add Elements in Stream (Also Not Allowed) +List names = new ArrayList<>(); +names.add("Alice"); +names.add("Bob"); +names.stream().forEach(name -> { + // names.add("Charlie"); // 🚫 Throws ConcurrentModificationException! +}); + +Q. How to response XML in spring boot rest controller? +Ans :✅ 1. Add JAXB or Jackson Dataformat XML Dependency +✅ 2. Annotate Your Model with JAXB Annotations +import jakarta.xml.bind.annotation.XmlElement; +import jakarta.xml.bind.annotation.XmlRootElement; + +@XmlRootElement(name = "user") +public class User { + + private int id; + private String name; + public User() {} // JAXB needs no-arg constructor + public User(int id, String name) { + this.id = id; + this.name = name; + } + @XmlElement + public int getId() { + return id; + } + @XmlElement + public String getName() { + return name; + } +} + +✅ 3. Create a REST Controller +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/api") +public class UserController { + + @GetMapping(value = "/user", produces = MediaType.APPLICATION_XML_VALUE) + public User getUser() { + return new User(101, "Niraj"); + } +} + +Q. ExecutorService and Executors ? And how to handle Execption with Future ? +Q. Runnable vs Callable ? +Ans : +| Feature | Runnable | Callable | +| ----------------- | ------------------ | -------------------------- | +| Return value | ❌ `void` | ✅ `V` | +| Checked exception | ❌ No | ✅ Can throw checked | +| Method | `run()` | `call()` | +| Uses | Threads, Executors | `ExecutorService.submit()` | +| Introduced in | Java 1.0 | Java 5 | +Q. Stream vs Collection ? +| Feature | **Collection** | **Stream** | +| ----------------------- | ----------------------------------- | ------------------------------------------ | +| **Storage** | Stores data (in memory) | Doesn't store data; works on data pipeline | +| **Nature** | Eager (loads all elements) | Lazy (evaluates elements on-demand) | +| **Data Source** | Data structure like List, Set, etc. | Data flows from Collection or Array | +| **Modifiable** | ✅ Yes (add/remove elements) | ❌ No (read-only) | +| **Traversal** | External iteration (e.g., for loop) | Internal iteration (e.g., `.forEach()`) | +| **Parallel Processing** | ❌ No built-in support | ✅ Yes, via `.parallelStream()` | +| **Reusability** | ✅ Reusable | ❌ Not reusable (use once only) | +| **Operations** | CRUD operations | Map-Reduce, Filter, etc. | + +Q.When colission in occuring and how to handle it and What is the roll of equals methd in HashMap ? +Ans : +🧪 Role of equals() in HashMap +If two keys have same hashCode, HashMap uses equals() to compare: +if (existingKey.hashCode() == newKey.hashCode() && existingKey.equals(newKey)) +If true → the key already exists → value is updated. +If false → it's a true collision → store as a separate node (LinkedList or TreeNode). + +Q. if we adding lacks of Employee object in ArrayList how to check ArrayList size again and again ? +Ans : +f you're adding lakhs of Employee objects to an ArrayList, and want to track or check its size periodically (for example, for monitoring or batching), here are several approaches: + +List list = new ArrayList<>(); +int count = 0; +for (Employee emp : employeesFromSource) { + list.add(emp); + count++; + if (count % 10000 == 0) { // Print after every 10,000 insertions + System.out.println("Size so far: " + list.size()); + } +} + +✅ 2. Using scheduled log (multi-threaded) [not common for just insertion] +ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); +executor.scheduleAtFixedRate(() -> { + System.out.println("Current size: " + list.size()); +}, 0, 5, TimeUnit.SECONDS); +✅ 4. Batching logic: Act on list size +if (list.size() >= 10000) { + saveToDatabase(list); // custom method + list.clear(); +} + +Q. Example of Autowiring by Type? +Q. How to consume mutilple rest controller using RestTemplate ? +Ans: Create bean and autowire it multiple time +============================================================================================= +Q. How to exclude beans in Spring Boot ? +Ans : @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class}) + +Q. What is AutoConfiguration in Spring boot ? + +Q.Given an integer array nums representing the amount of money of each house, return the maximum amount of money you can rob tonight without alerting the police. +Example 1: +Input: nums = [1,2,5,1] +Output: 6 +Explanation: Rob house 1 (money = 1) and then rob house 3 (money = 5). +Total amount you can rob = 1 + 5 = 6. +Example 2: +Input: nums = [2,7,9,3,1] +Output: 12 +Explanation: Rob house 1 (money = 2), rob house 3 (money = 9) and rob house 5 (money = 1). +Total amount you can rob = 2 + 9 + 1 = 12. +you have an array of {2 2,0,1,1,0} +OP :{2,1,1,0,0} +================================================================================================== +name,city ,salary +Q.find emp who have max salary for each City ? +Ans : +select name,city form employee group by city where emp having max(salary) ; + + +**********************************Star Health Care *********************************************** +Q. Suppose we are using Kafka producer and consumer case1 : Producer is down how to handle , case2: Consumer is down how to handle? +Q. How to run spring boot application ? +Ans : +@SpringBootApplication +public class StudentCrudApplication{ +public static void main(String[] args){ +StudentCrudApplication.run(StudentCrudApplication.class,args); +} +} +=============================================================================================== +Q. How to inject application.properties values? +Ans : +1. +app.name=StudentApp +app.version=1.0 + +@Component +public class AppConfig { + + @Value("${app.name}") + private String appName; + + @Value("${app.version}") + private String version; + + public void printValues() { + System.out.println("App Name: " + appName); + System.out.println("Version: " + version); + } +} +2. +student.name=John +student.age=22 +student.city=Delhi + +@Component +@ConfigurationProperties(prefix = "student") +public class StudentProperties { + + private String name; + private int age; + private String city; + + // getters and setters +} +3. +@Autowired +private Environment env; +String dbUrl = env.getProperty("spring.datasource.url"); + +Q. How to secure your spring boot application by malware or spam ? +Q. What is the starter dependency? +Q. Design LLD or HLD of spring boot application ? +Q. What is zookeeper ? + + +********************************************Cignix**************************************************** +Q. How to initialize bean in spring boot ? +Ans : +1. Using @Component Annotation +2. Using @Bean in a @Configuration class +3. Using @PostConstruct to Initialize After Bean Creation +4. Using InitializingBean Interface +5. Using CommandLineRunner / ApplicationRunner (after context loads) + +Q. Can we create constructor of Abstract class ? if we create then how to initialize it ? +Q. Can we make circular dependency of singleton class ? +Ans: +🔄 Summary Table +| Injection Type | Circular Singleton Allowed? | +| ---------------- | --------------------------- | +| Constructor | ❌ No | +| Field Injection | ✅ Yes | +| Setter Injection | ✅ Yes | +============================================================================================ +Q. What is Service Registery? +-------------------------------------------------------------------------------------------- +Q. Put vs Patch? +-------------------------------------------------------------------------------------------- +Q. @Service vs @Repository? + +*****************************R System******************************* +Q. Type of index in sql ? where index is storing. +Ans: +✅ 1. Single-column Index +Created on one column of a table. +Example: +CREATE INDEX idx_name ON employees(name); +✅ 2. Composite Index (Multi-column Index) +Created on two or more columns. +Order of columns matters during query optimization. +Example: +CREATE INDEX idx_name_dept ON employees(name, department_id); +✅ 3. Unique Index +Ensures that all values in the indexed column(s) are unique. +Automatically created with PRIMARY KEY or UNIQUE constraint. +Example: +CREATE UNIQUE INDEX idx_email ON employees(email); +✅ 4. Full-text Index +Used for full-text searches in large text fields. +Supported in databases like MySQL, PostgreSQL (with tsvector). +Example (MySQL): +CREATE FULLTEXT INDEX idx_description ON products(description); +✅ 5. Spatial Index +Used for indexing geospatial data (geometry or geography types). +Example (MySQL/PostGIS): +CREATE SPATIAL INDEX idx_location ON places(location); + +✅ 6. Bitmap Index (Mostly in Oracle) +Uses bits to represent data. +Best for columns with low cardinality (e.g., gender, status). +Not commonly used in OLTP systems. + +✅ 7. Clustered Index +Sorts the actual data physically on disk based on the key. +Only one clustered index per table (commonly the primary key). +Default in SQL Server and MySQL (InnoDB). + +✅ 8. Non-clustered Index +Stores the index separately from the data. +Can have multiple non-clustered indexes. +Includes a pointer to the actual data row. + +✅ 9. Function-based Index +Indexes the result of a function or expression on a column. +Example (Oracle or PostgreSQL): +CREATE INDEX idx_upper_name ON employees (UPPER(name)); +✅ Summary Table: +| Index Type | Unique? | Multiple per Table? | Notes | +| --------------- | ------- | ------------------- | ---------------------------------- | +| Primary Key | Yes | No | Automatically indexed | +| Unique Index | Yes | Yes | Prevents duplicates | +| Clustered Index | No | One | Sorts physical data | +| Non-clustered | No | Yes | Logical pointer to data | +| Composite Index | Varies | Yes | Multiple columns | +| Full-text Index | No | Yes | Search inside text | +| Spatial Index | No | Yes | For spatial (map) data | +| Bitmap Index | No | Yes (Oracle) | Low-cardinality fields | +| Function-based | Varies | Yes | Indexes functions on column values | +========================================================================================================== +Q: What is Cartesian Product in SQL? +Ans: +📘 Definition: +A Cartesian Product in SQL is the result of a cross join between two tables without a WHERE clause or join condition. +It combines each row from the first table with every row from the second table. +🧮 Formula: +If: +Table A has m rows +Table B has n rows + +Then: +Total rows in Cartesian Product = m × n +📊 Example: +Table A (Employees) +| ID | Name | +| -- | ----- | +| 1 | John | +| 2 | Alice | + +Table B (Departments) +| DeptID | DeptName | +| ------ | -------- | +| 10 | IT | +| 20 | HR | +Query: +SELECT * FROM Employees, Departments; +-- OR +SELECT * FROM Employees CROSS JOIN Departments; + +⚠️ When Does It Happen Accidentally? +You forget to write a join condition in a JOIN. +You mistakenly use CROSS JOIN instead of INNER JOIN. + +✅ When is it Useful? +Generating combinations or test data. +Creating permutations across tables. +================================================================================================================ +Q. Kfka Architecture ? +Q. default actuator urls ? how to enable all urls . +Ans: +🚀 Common Actuator Endpoint +| Endpoint | Description | +| ---------------------- | ----------------------------- | +| `/actuator` | Lists all available endpoints | +| `/actuator/health` | Application health status | +| `/actuator/info` | Custom application info | +| `/actuator/metrics` | Application metrics | +| `/actuator/env` | Environment properties | +| `/actuator/beans` | All Spring beans | +| `/actuator/mappings` | Controller method mappings | +| `/actuator/threaddump` | Thread dump info | +| `/actuator/loggers` | Logger configuration | +management.endpoints.web.exposure.include=* +management.endpoint.health.show-details=always +============================================================================================================== +Q. Spring Bean lifecycle ? +Ans:📌 Full Spring Bean Lifecycle Phases +1. Instantiation +2. Populate Properties (Dependency Injection) +3. BeanNameAware#setBeanName +4. BeanFactoryAware#setBeanFactory +5. ApplicationContextAware#setApplicationContext +6. Pre-Initialization (BeanPostProcessor#postProcessBeforeInitialization) +7. InitializingBean#afterPropertiesSet OR @PostConstruct +8. Custom init-method (if configured) +9. Post-Initialization (BeanPostProcessor#postProcessAfterInitialization) +10. Bean is Ready to Use +11. Destruction: PreDestroy → destroy() → custom destroy-method +================================================================================================================ +Q. What is Metaspace in java ? +Ans: +Metaspace is a memory area in the Java Virtual Machine (JVM) that stores class metadata (information about class structure like methods, fields, constant pool, etc.). +📌 Background +In Java 8 and earlier, PermGen (Permanent Generation) was used for class metadata. +Java 8+ replaced PermGen with Metaspace for better memory management. +📂 Metaspace vs PermGen +| Feature | PermGen (≤ Java 7) | Metaspace (Java 8+) | +| ------------- | -------------------------------------- | ------------------------------------------- | +| Memory type | Part of JVM heap | Native (outside JVM heap) | +| Sizing | Fixed (OutOfMemoryError) | Grows automatically by default | +| Configurable? | `-XX:PermSize`, `-XX:MaxPermSize` | `-XX:MetaspaceSize`, `-XX:MaxMetaspaceSize` | +| GC-managed | Yes | Yes | +| OOM cause | Too many classes or large classloaders | Same, but less frequent | +📊 How to Configure Metaspace +You can control Metaspace size with: +-XX:MetaspaceSize=256m # Initial size +-XX:MaxMetaspaceSize=512m # Max limit (optional) + +⚠️ Common Error +java.lang.OutOfMemoryError: Metaspace +Cause: +Too many classes are loaded, often due to: +Dynamic proxy/class generation (e.g., Hibernate, CGLIB) +Improper classloader usage (e.g., in web apps) + +🧠 What’s Stored in Metaspace? +Class definitions (metadata) +Constant pool +Field/method names and types +Method bytecode (some part) +==================================================================================================================== +Q. How to create constant pool ? +Q. How to create bean in spring boot ? +Ans: +✅ 1. Using @Component, @Service, @Repository, @Controller +✅ 2. Using @Bean in a @Configuration class +✅ 3. Accessing the Bean (Example: Autowiring it) +✅ Summary +| Method | Annotation Used | Detection | +| -------------------- | ------------------------------------------------------ | ----------------------------- | +| Automatic via scan | `@Component`, `@Service`, `@Repository`, `@Controller` | Detected via `@ComponentScan` | +| Manual configuration | `@Bean` inside `@Configuration` | Explicitly defined | + +***********************Accolite Second Round************************************ +Q. Find out the index of the student whose name is Devendra? +Ans: +public int findIndex(List students, String targetName) { + for (int i = 0; i < students.size(); i++) { + if (students.get(i).getName().equalsIgnoreCase(targetName)) { + return i; // Index of Devendra + } + } + return -1; // Not found +} + +Q. find Max sum of Array ? +Ans: + int[] arr = {1, 4, 2, 3, 14, 5, 2}; + Arrays.sort(arr); + int maxTwoSum = arr[arr.length - 1] + arr[arr.length - 2]; + System.out.println("Max sum of any two elements: " + maxTwoSum); // 14 + 5 = 19 + +Q. How will create the Optional Object? +Ans: +public void check(Object k) { + Optional optional = Optional.ofNullable(k); + + if (optional.isPresent()) { + System.out.println("Value: " + optional.get()); + } else { + System.out.println("Value is null"); + } + } + +Q. Suppose we are using Kafka producer and consumer case1 : Producer is down how to handle , case2: Consumer is down how to handle? +Q. How to run spring boot application ? +Q. How to inject application.properties values? +Q. How to secure your application by malware or spam ? +Q. What is the starter dependency? +Q. Design LLD or HLD of spring boot application ? + + +Q.find second highest salary optimized +Employee : salary +select salary from employee order by salary desc offset 1 limit 1; + +Q. Design schema ? +1. Orgnization : org_id,org_name,org_type,org_add +2. Department : dept_id,org_id +3. Manager : manager_id,dept_id,manager_name +4. Employee : emp_id,dept_id,manager_id,emp_name + +Q. find list of all employee whose manager name is "Venkat" +Ans: +select emp.name,mg.manager_name form employee e inner join Manager mg on e.manager_id = mg.manager_id where mg.manager_name = "Venkat" + +Q. find even number from list of Integer? +List integers = Arrays.asList(1,2,3,4,5,6,7,8,9); +List evenInt = integers.stream().filter(n->n%2==0).collect(Collecttors.toList()); + + +class Employee{ +int age; +String name; + + +} + +// grp emp by age ? +Map> grpEmpByAge = list.stream().collect(Collecttors.groupingBy(Employee::getAge)); + + +Q. suppose one interface is imlimented by 2 classess then how to inject implimented classess in controller spring boot ? +interface Vhicle{ + + +} + +class Car imliment Vhicle{ + +} + +@Componet("") +class Truck imliment Vhicle{ + +} + + +class Controller{ + + +} + +Q. can we create new Transactional session under @Transactional annoted method in spring boot ? + +Q. suppose we call new method in @Transactional annotated method the new method in not annotated @Transactional, is the new method will also work like @Transactional method + +Ans : +❓Scenario: +You have a method methodA() annotated with @Transactional. + +Inside it, you call another method methodB(), which is not annotated with @Transactional. + +✅ Answer: +Yes, methodB() will still run within the same transaction started by methodA(). + +✅ Why? +In Spring, when a method is annotated with @Transactional, a transaction is started before the method body runs, and it continues to be active during any internal method calls, unless overridden. + + +Q. suppose we have 3 Transactional method in spring boot jpa if one method get exception what will happened ? + +Q. Asynchronous annotation in spring boot java ? + +Q. How to give s2 bucket access using authentication ? + +Q. How to run code in aws lambda ? +Q. map vs flatMap? +Q. Intermediate vs Terminal ? +Q. SAGA design pattern ? +Q. use of Singleton design pattern in spring boot ? +Q. @Resource annotation in spring boot? +Q. How to debug microservices ? +Q. Image vs Container in docker ? +Q. How to check log in docker image ? +Q. one microservice is down then how to handle for user ? + +Q. +@Transactional +public void methodA() { + // Transaction starts here + + @Transactional + methodB(); // This runs inside the same transaction + + // Transaction ends here (commit/rollback) +} + +public void methodB() { + // Runs inside methodA's transaction +} +✅ What Will Happen in Your Case? +Even though methodB() is annotated with @Transactional, when it's called internally from methodA(), it will not start a new transaction. Instead: + +methodA() starts a transaction. + +methodB() runs within the same transaction. + +Any transaction settings on methodB() (like REQUIRES_NEW, READ_ONLY, etc.) will be ignored. + + +Q.What is Transactional properties ? + +Q.Find the Most Frequent Character +Ans : +String str ="devendra"; +List strTOChar = str.chars().mapToObj(c->(char)c).collect(Collecttors.toList()); +Map mostOccurance = strTOChar.stream().collect(Collecttors.groupingBy(Cahracter::getChar,Collecttors.counting())) + .entrySet().stream().max(Map.Entry.comparingByValue); +================================================================================================================ +Q. find second max from array ? + +int arr[] = {5,8,6,1,3,2}, +int secondMax = Arrays.stream(arr).boxed().sorted(Comparator.reverseOrder()).limit(2).skip(1).findFirst().get(); +=============================================================================================================== +Q. Find most occurance character ? +String str = "devendra"; +Optinal> maxOccurCharacter =Arrays.stream(str.split("")).collect(Collectors.groupingBy(Cahracter::charValue,Collectors.counting())).stream().entrySet().max(Map.Entry::comparingByValue) + +Map map = list.stream().collect(Collectors.toMap(Employee::getId,Employee::getName,((newVal,OldVal)->oldVal))) +================================================================================================================= +Q. Short map by values ? +Map shortByVal = map.entrySet().stream().sorted(Map.Entry::comparingByValue).collect(Collectors.toMap(Map.Entry::getKey,Map.Entry::getValue,(o,n)->o,LinkedHashMap::new)); +========================================================================================================== +Q.Write a program to find duplicate elements in a given integers list in java using Stream functions? + +example +input : 10,10,10,15,15,15,8,49,25,98,98,32,12 +output : 10,15,98 + +List list = Arrays.asList(10,10,10,15,15,15,8,49,25,98,98,32,12); +Set set = new HashSet<>(); +Set duplicate = list.stream().filter(list1->!set.add(list1)).collect(Collectors.toSet()); //// `add()` returns false if item already exists +================================================================================================= +Q. Write a program to find the first non-repeated character in it using Stream functions? +input - String str = "Java articles are awesome"; +o/p - J +Ans: +String str = "Java articles are awesome"; +List characters = str.chars().mapToObj(c->(char)c).collect(Collectors.toList()); + + Map nonrepeated = characters.stream().collect(Collectors.groupingBy(Character::charValue,LinkedHashMap::new,Collectors.counting())).filter(entry->entry.getKey()==1) + .collect(Collectors.toMap(Map.Entry::getKey,Map.Entry::Value,(e1, e2) -> e1,LinkedHashMap::new)); +========================================================================================================================= +Q. What is the output? +class A{ + + a1() { + B b = new B() + try{ + SOP("try block"); + b.b1() + }catch(NPE e){ + SOP("catch block"); + } + } +} + +class B{ + + b1() throws AE{ + SOP("B1 method"); + } +} +================================================================================================== +Q. How many object is created here ? and what the output? +Ans: +Only one object is created in the String Pool. +String s3 = "concentrix"; +String s4 = "concentrix"; +System.out.println(s3 == s4); //false + +===============================Back Base Hyderbaad================================= +Q. What is DDT ? +Q. What is fallback ? +Q. What is bulkhead ? +Q. Anti design pattern +Q. how to do single transaction with @Transaction annotation +Q. can we test private method +Q. @Mock vs Spine ? +Q. interface vs Multilevel inheritence ? + +Given a list of transactions, find the sum of transaction amounts for each day using Java streams: +List transactions = Arrays.asList( + new Transaction("2022-01-01", 100), + new Transaction("2022-01-01", 200), + new Transaction("2022-01-02", 300), + new Transaction("2022-01-02", 400), + new Transaction("2022-01-03", 500) +); + + +class Transaction { +Date day; +double amount + +} + +Given a list of transactions, find the sum of transaction amounts for each day using Java streams: +Map transactions = list.stream().collect(Collectors.groupngBy(Transaction::getDay,Double::sum)); + + +given a list of numbers find 2nd largest even number + + +Double secondLargest = list.stream().sorted(Compartor.comparing(Transaction::getAmount).reverseOrder()).filter(amount->amount%2==0).limit(2).skip(1).orElse(null) + +String s + +String s = new + +class Parent { + +} + +class Base { +} + +class Test extends Parent{ + +} + +class Base extends Test{ + +} + +interface Test { + +1 +2 +3 +} + +clasd Test1 impliment Tes{ + +} + + +=============================HCL Nagpur ======================================= 13-09-2025 +class Employee +private int id; +private String name; +private int age +private String pin; + +//getter +//setter +} + +Q. sort by age and name ? +List sortNameAge = list.stream().sorted(Comparator.comparing(Employee::getAge).thenComparing(Employee::getName)).collect(Collectors.toList()); + + +public class Singleton{ + +private static volatile Singleton singleton=null; + + +public static Singleton getInstance(){ + + if(singleton ==null){ + synchronized(Singleton.class){ + if(singleton==null){ + singleton = new Singleton(); + } + } + } + + return singleton; + + } + + + } + +class Transaction{ +int userid; +double amount; + +} + +Q. total amount spend by each user ? + +Map amountHaveEachUser = list.stream().collect(Collectors.groupingBy(Transaction::getUser, Collectors.summingDouble(Transaction::getAmount))); + +Q. find top 5 customer ? +select customer_id from customer order by customer_id asc limit 5; + +Q. find duplicate user ? +Ans: SELECT userid, COUNT(*) as cnt FROM user GROUP BY userid HAVING COUNT(*) > 1; +Q. CrudRepository vs JpaRepository vs PagingAndSortingRepository ? +Q. Dependency Injection ? +Q. circular dependency ? +Q. Scheduling Fix delay vs Fix Rate ? +Q. Kafka ? +Q. SAGA Design pattern ? +Q. Actuators ? how to expose all urls ? +Q. Spring boot default server ? can we exclude it ? +Q. Validate rest api ? +Q. JWT ? +Q. equls vs == ? +Q. contract b/w hashCode and equals() +Q. Exception handling in Spring boot ? +Q. Microservices architecture ? + a. service registery? + b. service config ? + c. API Gateway and load balacing ? + d. circuit breaker ? + e. SAGA design pattern ? + + + + +Q. find 3rd Max salary ? +Double thirdMaxSal = list.strem().sorted(Comparator.comparing(Employee::getSalary).reversOrder).limit(3).skip(2).map(Employee::getSalary).orElseNull(""); + +Q. functioanl interface ? + +interface Calculator(){ +int add (int a,int b); + +default int sub(int a,int b){ + +int sub + +} + +static int mult(int a, int b){ + +} + +} + +class Test impliments Calculator { + +public int add(int a,int b){ + +int + +} + + +public void main(String[] args){ + + +int sum = new Test().sum(10,20); + +int mult = Calculator.mult( + +} + + +} + +================================HCL Nagpur 2nd round========================================== +Q. How to create our own marker interface ? +Q. What will happened if Consumer will stop in Kafka ? +Q. What is SAGA design pattern ? +Q. What if happened if server is overloaded in production ? +Q. What is Rentrant Lock ? +Q. How to avoid dead lock in Thread ? +Q. What is default size of ArrayList=10 and How ArrayList is growing dynamically? +Q. HashMap Time complexicity ? +Q. How ConcurrentHashMap performing add, remove operation simultaniusly ? +Q. How to avoid confidentials data from log in production application in spring boot ? +Q. find output ? +class Test{ + +String args[] = { "1", "2" }; + +public static void main(String args[]) { + + if(args.length >0) + { + sop(args.length); + } + + } + +} +o/p : nothing +Q. is it possible assigning if not how to silve it ? +List objectList = new ArrayList<>(); +List stringList = new ArrayList<>(); + +objectList = stringList; +Ans : compile time error is rigth + + // String str = (Object) objectList; + + +Q. find output ? +String s1 = "March"; +String s2 = "March"; +String s3 = s1; + +s1 = "April"; +s2.concat("May"); +String newS3 = s3.concat("June"); + +sop(s1); // April +sop(s2); // March +sop(s3); // March +sop(newS3); // MarchJune + +Q. +class A{ +public void m1(){ +sout("Parent"); +} +} +public class B{ +public void m1(){ +sout("child"); +} + +public static void main(String args[]){ +B a = new A(); +a.m1(); + +} +} + +Ans : Compile time exception + +Q. How to create Abstract class Object and How to access Abstract class Parametrize constructor ? +abstract class Test { + int value; + + // Parameterized constructor + public Test(int a) { + this.value = a; + System.out.println("Abstract class constructor called, value = " + a); + } + + // Abstract method (optional) + public abstract void display(); +} + +class Test1 extends Test { + public Test1(int a) { + // Call parent constructor + super(a); + } + + @Override + public void display() { + System.out.println("Child class implementation, value = " + value); + } +} + +public class Main { + public static void main(String[] args) { + // ✅ Correct: create object of child + Test1 obj = new Test1(10); + obj.display(); + + // ✅ Or reference parent, hold child object + Test parentRef = new Test1(20); + parentRef.display(); + } +} + + + +Q.find duplicate employee ? + +Ans: select emp_id, count(*) as ids from employee group by emp_id having count(*) > 1; + +Q.Get Employee names whose Join date before 31 Aug ? +clas Employee{ + + private Date joiningDate + + +} + +Ans : +Date cutoff = new SimpleDateFormat("dd-MM-yyyy").parse("31-08-2025"); +List names = list.stream().filter(e -> e.getJoiningDate().before(cutoff)).map(Employee::getName).collect(Collectors.toList()); + + +Q. o/p :- {3=[bat,cat], 5=[apple],4=[ball]} +Ans: Map> map = list.stream().collect(Collectors.groupingBy(String::length)); + +✅Q. What is @Lookup in Spring? +Ans: +@Lookup is used in Spring beans to inject a prototype-scoped bean into a singleton-scoped bean. +Since singletons are created only once, normally you can’t get a new instance of a prototype every time. +@Lookup tells Spring to override the annotated method at runtime and return a new bean from the context each time it’s called. +🔹 Problem it Solves + +Suppose you have: +SingletonBean (lives for the whole app lifecycle). +PrototypeBean (a fresh instance should be created on each request). +If you just autowire a PrototypeBean inside a singleton, you’ll always get the same instance (defeating the purpose) +🔹 How @Lookup Works +@Component +class PrototypeBean{ + public PrototypeBean(){ + System.out.println("PrototypeBean created: " + this); + } +} +@Component +class SingletonBaean{ + //method will be overriden by spring + public PrototypeBean getPrototypeBean(){ + return null; // spring override this at time + } + + public void show(){ + PrototypeBean prototypeBean = getPrototypeBean(); + System.out.println("Using " + prototypeBean); + + } + +} + +public class LookupExample { + + public static void main(String[] args){ + ApplicationContext ctx = SpringBootApplication.run(LookupExample.class,args); + + SingletonBaean stb1 = ctx.getBean(SingletonBaean.class); + stb1.show(); + + SingletonBaean stb2 = ctx.getBean(SingletonBaean.class); + stb2.class(); + + //above both call will generate different hashcode because we are over riding Singleton behavior + } +} + + Q. What is @LoadBalanced annotaion? + Ans: + @LoadBalanced is an annotation used in Spring Cloud to enable client-side load balancing on a RestTemplate or WebClient. + It works with service discovery (like Eureka, Consul, Zookeeper). + Instead of calling services using fixed host:port, you call them using service name, and the load balancer distributes requests across multiple instances. + Example: Without @LoadBalanced + @Bean + public RestTemplate restTemplate() { + return new RestTemplate(); + } + + Usage : String response = restTemplate.getForObject("http://localhost:8081/employee/1", String.class); + 👉 Here you must hardcode localhost:8081. + 🔹 With @LoadBalanced + @Bean + @LoadBalanced + public RestTemplate restTemplate() { + return new RestTemplate(); + } + +Usage : String response = restTemplate.getForObject("http://EMPLOYEE-SERVICE/employee/1", String.class); + 👉 Now you use service name (EMPLOYEE-SERVICE) instead of IP/port. +The LoadBalancerClient picks one available instance of EMPLOYEE-SERVICE registered in Eureka/Consul. +🔑 Key Points +@LoadBalanced enables client-side load balancing in Spring Cloud. +Works with RestTemplate and WebClient. +Requires a service discovery mechanism (Eureka, Consul, etc.). +Balancing strategy can be Round Robin, Random, Weighted, etc. + + + Q. Circular dependency ? + Ans : we can avoid it using @Lazy annotation + Q. NoUniqueBeanDefinitionException ? + Q. ClassNotFoundException ? + Ans : +ClassNotFoundException → Checked exception, occurs when using reflection (Class.forName()) to load a class that doesn’t exist in classpath. + + public class Demo { + public static void main(String[] args) { + try { + Class.forName("com.example.MyClass"); // tries to load dynamically + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } +} + Q. NoClassDefFoundError ? + Ans : + NoClassDefFoundError → Error (unchecked), occurs when JVM tries to load a class at runtime (already compiled successfully), but class definition is missing from classpath. + class A { + static { + System.out.println("Class A loaded"); + } + void show() { + System.out.println("Hello from A"); + } +} + +public class Demo { + public static void main(String[] args) { + A obj = new A(); + obj.show(); + } +} +Compile: javac Demo.java → Compilation successful (because A.class was found). + +Now delete A.class file and run: 👉 Output: Exception in thread "main" java.lang.NoClassDefFoundError: A +✅ In short: +ClassNotFoundException = explicitly asked but never existed. +NoClassDefFoundError = was there at compile time, but disappeared at runtime. + + Q. How to handel Exeption in Kafka ? + Ans : + Q. How to Design rough and tough rest API + Q. Circiut breaker stages + Q. Drawback of finalize() + Q. Internal working of Garbage collector ? + Q. How to handle json Deserialization Exception ? + Q.Create rest API with following validations ? + 1.file input , size (100mb) , extension (.pdf,.txt), filename (employeedata.txt.txt.pdf) + 2.file name less then 150 character , file name should not contain special character? + +Q.Project --->(Group 1,(Group 2(Group 3(Group 4)))) ...... 10nth ---> have 5 task may be multiple task ---->Linked with group and sub group design database ? + +Q.Distributed transaction in microservcies ? +Q.Optimsutic and Pasimistic locking ? +Q. Create Pattern by Java Program? + +** ** +** ** + * +** ** +** ** + + +Q. int[] arr = {10,20,0,0,15,25,10,0}; // shift all zeros to right + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +1.print prime + +Input: + +[1, 9, 100, 19090908090909091, 7, 8, 6] + + +Output : print prime + +Int [] arr = {1, 9, 100, 19090908090909091, 7, 8, 6}; + +for(int i=0;i