Advertisement
bejiitas_wrath

Students array.

Sep 3rd, 2013
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. /*
  2.  * My first Java program.
  3.  *
  4.  */
  5.  
  6. import java.util.Arrays;
  7.  
  8. public class Employees {
  9.  
  10.     public static void main(String[] args) {
  11.  
  12.         String[] myStringArray = new String[]{"Rodney","Daniel","Bavita", "Peter", "Imran", "Lobosh", "Yuting", "Carl"};
  13.         int[] myIntArray = new int[]{333,221,401,297,116,250,354,134};
  14.  
  15.         System.out.printf("\nSorted list of names.\n");
  16.  
  17.         /* args is the list of Employees. */
  18.  
  19.         Arrays.sort(myStringArray);
  20.  
  21.         for(int i = 0; i < myStringArray.length; i++) {
  22.             System.out.println(myStringArray[i]);
  23.         }
  24.  
  25.         System.out.printf("\nEnd of sorted list.\n");
  26.  
  27.         for(int j=0; j< 8; j++ ) {
  28.  
  29.             System.out.printf("\nScore: " + myStringArray[j] + ", " + myIntArray[j] + ".\n");
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement