ochakovo

Untitled

Aug 5th, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. class Index{
  2. int num;
  3. }
  4.  
  5. class Islands{
  6. String name;
  7. }
  8.  
  9.  
  10. public class ArrayTest {
  11.  
  12. /**
  13. * @param args
  14. */
  15. public static void main(String[] args) {
  16. // TODO Auto-generated method stub
  17.  
  18. Index[] myIndex = new Index[4];
  19. Islands[] myIslands = new Islands[4];
  20.  
  21. int x=0;
  22.  
  23. while(x<4){
  24. myIndex[x] = new Index();
  25. myIslands[x] = new Islands();
  26. x++;
  27. }
  28.  
  29. myIndex[0].num=1;
  30. myIndex[1].num=3;
  31. myIndex[2].num=0;
  32. myIndex[3].num=2;
  33.  
  34. myIslands[0].name="Bermuda";
  35. myIslands[1].name="Fiji";
  36. myIslands[2].name="Azores";
  37. myIslands[3].name="Cozumel";
  38.  
  39. int ref [] = new int[4];
  40. x=0;
  41. while(x<4){
  42. ref[x] = myIndex[x].num;
  43. x++;
  44. }
  45.  
  46. x=0;
  47. /*while(x<4){
  48. System.out.println(myIslands[ref[x]]);
  49. x++;
  50. }*/
  51. }
  52. }
  53.  
  54. }
Add Comment
Please, Sign In to add comment