Skip to main content

Posts

Bubble short program in core java

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 + " "); } } }
Recent posts

Spring Boot Interview Questions

  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 ).             

Html Basics

  image source - google 1: What is HTML ? A:  HTML is a Hiper Text Markup Language, it's basicaly means we can structure our web document throw html markups.If we want to make a web page or web documrnt then we have to first start with the html, like this, <Html>     <Head>     </Head>     <Body>     </Body> </Html> 2: What is <Head>? A: Head is a child tag of Html, this comes under the html parent tag, and it contains the the information about the html page, like css file link, js file link, meta info. , screen size info, and other if you are using bootstrap or popper.js or any jquery file link. 3: What is <Body>? A: Body is also a child tage of html tag but it contain's the data which visible on the wab page only.             like, Tables, Images, List's, Drop Down etc.. 4: Which  basics thing's that we have to remember in general at the time of mking any web page using html ? A: 1: We should save the file with .html ext

Java Inheritance

#Java Inheritance Interview Questions      #inheritance | #multilelelinheritance | #single inheritance | #javainheritance | #oppsinheritance |     #java  | #OOps | #corejava | #corejavainheritance | #java inheritance | #coreinheritance |   #oopjavainheritance   1: What is inheritance?   A: Inheritance is the most important feature in any object-oriented programming language, This is a                child-parent relationship that allows as to reuse the same logic or same code in a specific manner.   2: How many types of inheritance are supported by java? A:  4 types of inheritance are supported by java,           Single-Level, Multi-Level, Hierarchical, Multiple. Note: In java multiple inheritance, we can achive through Interface.                                                                Single Level inheritance Multi-Level inheritance Hierarchical   inheritance

Core java collection framework interview questions and answers second part...

                                            1: which classes of collection framework that takes only homogeneous (same type) objects only. Ans: Only there are two classes that takes homogeneous elements those are TreeSet and TreeMap.                                                   2: How ArrayList work's internally? Ans:             Example :       ArrayList :     | 1 | 5 | 6 | 9 | 4 | 5 | 2 | 11 |      Size : 8      index : 0 - 7 arraylist is same as an array but it's dynamic array so, it increases it's size when required.    when you create a arraylist object initially it's size will be 10, and as you inter any value that  will go in in index 0 , and it's the starting index.      in the above example we have an arraylist that contains 8 elements and new it's full so if we try to insert more element in this list then automatically JVM create a new ArrayList and Copy all the data from this list and past it into the newly created list. and the size of the new l

Java Collection Framework Most Important Questions

  Java Collection Framework Most Important Questions   Q:-1   What is Collection Framework ? A:-     Collection framework is a unified architecture or predefined java classes and interfaces that is used for implementing  a group          of objects in java. Q:-2   What is Collection ? A:-     A collection represents a group of objects. And it is root interface of java collection hierarchy. Q:-3   What is Collections ? A:-     Collections is a utility class in java which is present is java.util package for manipulating  data. It provides static method for             searching, sorting and more. Q:-4   What is difference between Array and Collection ? A:-                 Array                                                                            Collection                                                    1>     Array is a object in java which                    Collection is a interface which contains                contains similar data elements.                   method

Basic Core Java Interview Questions | Core java | Java Questions | Core Basics | Interview Questions | Java Questions | Core Java Basics | OOP in java | Object oriented programming | Object oriented programming in java

Basic Core Java Interview Questions | Core java | Java Questions | Core Basics | Interview Questions | Java Questions | Core Java Basics | OOP in java | Object oriented programming | Object oriented programming in java 1. What is OOP? A. OOP extends for Object oriented programming. It is a paradigm of programming which works on object. In object oriented programming everything is in the form of          object. In java except primitives everything in the form of object. For converting primitives to object we can use wrapper classes concept in java. 2. What is Abstraction? A. Abstraction is nothing but hiding the internal implementation and showing some set of services to the end user is called abstraction. 3. How can we use abstraction in java? A. We can use abstraction in java with the help of Interface and Abstract class. 4. What is Abstract class? A. Abstract class is special type of class which is declared by abstract keyword and used to achieve abstraction. It can't be instant