Tag: JAVA
-
Sorting Code (Ascending order and Descending order)
Ascending order sort code in java import java.util.*;public class AscendingOrder{public static void main(String abcd[]){int n, comp; //declaration of length of array(n) and temporary variable for swappingScanner s = new Scanner(System.in); //creating object for scanner classSystem.out.print(“Enter no. of elements in array:”);n = s.nextInt(); //storing input from the userint a[] = new int[n]; //declaration of arraySystem.out.println(“Enter the…
-
Difference among Class, Interface and Abstract class
CLASS Supports only concrete methods (Method with heading and body). Do not support abstract methods. We can declare class as a final type. It supports variable. It supports constants which should be declare as final. By default, access modifier of class is default. It supports constructors. Instance methods are allowed. It supports static method since…
