Question: JAVA: I created an applet that takes the array of numbers and sorts them into ascending order. When I run the file, it prints it
JAVA: I created an applet that takes the array of numbers and sorts them into ascending order. When I run the file, it prints it out both times in the ascending order, it doesn't show the original order.
Sort.java
import java.awt.Graphics; import java.applet.Applet; public class Sort extends Applet { int a[] = { 55, 25, 66, 45, 8, 10, 12, 89, 68, 37 }; public void paint(Graphics g) { print(g,"Data items in original orer",a,25,25); sort(); print(g,"Data items in ascending order",a,25,55); } /* A Sorting method here. */ public void sort() { int i,j,t; for(i=0;i<10;i++) { for(j=0;j<10;j++) { if(a[i] SortLogic.html
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
