public class BubbleSort { public static void bubbleSort(int[] arr) { int n = arr.length; for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - i - 1; j++) { if (arr[j] > arr[j + 1]) { // Swap arr[j] and arr[j+1] int temp = arr[j]; arr[j] = arr[j + 1]; arr[j + 1] = temp; } } } } public static void main(String[] args) { int[] arr = {64, 34, 25, 12, 22, 11, 90}; System.out.println("Array before sorting:"); for (int num : arr) { System.out.print(num + " "); } bubbleSort(arr); System.out.println("\nArray after sorting:"); for (int num : arr) { System.out.print(num + " "); } } }
S pring Boot Interview Questions image source - google 1: What is spring boot? A: Spring boot is a project that is created on the spring framework by pivotal people to create minimum configuration and production ready application. 2: What is the current and latest version of spring boot? A: 2.2.1 3: What @Autowired annotation does in spring boot and spring framework? A: @Autowired annotation tells spring to inject the dependency of this bean to this class. we can use this annotation in both setter and constructor dependency injection 4: How to create a Spring boot project? A: Their are 2 way's to create spring boot project. first one is using spring official site Spring Initiliazr and the other one is using IDE ( spring tool shuit or Intellij ).