1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import java.io.*; class Bubble{ public static void main(String args[])throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int arr[] = new int[20]; System.out.print("Enter the number of elements : "); int elements = Integer.parseInt(br.readLine()); for(int i=0;i<elements;i++){ System.out.print("\nEnter the element " + (i+1) + " : "); arr[i]=Integer.parseInt(br.readLine()); } int temp; for(int i=0;i<elements;i++){ for(int j=i;j<elements;j++){ if(arr[i]>arr[j]){ temp=arr[i]; arr[i]=arr[j]; arr[j]=temp; } } } // print elements for(int i=0;i<elements;i++){ System.out.print(arr[i] + ","); } } } |
Java
Java Applet Of Moving Plane
“applet” class [crayon-5a2bbad46fdf8010807135/] HTML File [crayon-5a2bbad46fe07150071679/] How to Run After compilation you can use “appletviewer” to run your applet. appletviewer xyz.html