Crenox

TestArrays Program

Jan 29th, 2014
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. package samkough.main;
  2.  
  3. public class TestArrays
  4. {
  5. public static void main(String args[])
  6. {
  7. int y = 0;
  8. int [] index = new int[4];
  9. String [] islands = new String[4];
  10.  
  11.  
  12. index[0] = 1;
  13. index[1] = 3;
  14. index[2] = 0;
  15. index[3] = 2;
  16.  
  17. islands[0] = "Bermuda";
  18. islands[1] = "Fiji";
  19. islands[2] = "Azores";
  20. islands[3] = "Cozumel";
  21.  
  22. int ref;
  23. while (y < 4)
  24. {
  25. ref = index[y];
  26.  
  27. System.out.print("island = ");
  28. System.out.println(islands[ref]);
  29. y = y + 1;
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment