Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. package myArray;
  2.  
  3. import java.lang.reflect.Array;
  4.  
  5. public class praArray {
  6. public static void main(String[] args) {
  7. Person[] array = new Person[3];
  8.  
  9. Person one = new Person("迪丽热巴",12);
  10. Person two = new Person("张雪峰",22);
  11. Person three = new Person("考研",23);
  12.  
  13. array[0] = one;
  14. array[1] = two;
  15. array[2] = three;
  16.  
  17. System.out.println(array[0]);//只能打印地址值
  18. System.out.println(array[1]);//只能打印地址值
  19. System.out.println(array[2]);//只能打印地址值
  20.  
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement