import java.util.Arrays;
public class ArrayEx {
public static void main(String args[]){
int[] myArray2 = new int[]{23,2,21,4,5};
Arrays.sort(myArray2);
for(int i =0;i<myArray2.length;i++){
System.out.println(myArray2[i]);
}
String[] names = new String[]{"Peter", "Patricia", "Hunter", "Sarah",
"Gabe", "Gina", "Rob", "John", "Zoey", "Tammy", "Robert",
"Sean", "Paschal", "Kathy", "Neleh", "Vecepia" };
Arrays.sort(names);
for(int a=0;a<names.length;a++){
System.out.println(names[a]);
}
}
}
No comments:
Post a Comment