Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Index{
- int num;
- }
- class Islands{
- String name;
- }
- public class ArrayTest {
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- Index[] myIndex = new Index[4];
- Islands[] myIslands = new Islands[4];
- int x=0;
- while(x<4){
- myIndex[x] = new Index();
- myIslands[x] = new Islands();
- x++;
- }
- myIndex[0].num=1;
- myIndex[1].num=3;
- myIndex[2].num=0;
- myIndex[3].num=2;
- myIslands[0].name="Bermuda";
- myIslands[1].name="Fiji";
- myIslands[2].name="Azores";
- myIslands[3].name="Cozumel";
- int ref [] = new int[4];
- x=0;
- while(x<4){
- ref[x] = myIndex[x].num;
- x++;
- }
- x=0;
- /*while(x<4){
- System.out.println(myIslands[ref[x]]);
- x++;
- }*/
- }
- }
- }
Add Comment
Please, Sign In to add comment