






















































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!























































Every Person object have name, weight, height But different value for those attributes^
ke.name=Ke Wang, sal.name=Sal Stolfo
Name: Ke Wangheight: 0weight: 0 Name: Salvatore J. Stolfoheight: 0weight: 0
ke sal
Name: Ke Wangheight: 0weight: 0 Name: Salvatore J. Stolfoheight: 0weight: 0
ke x sal references
objects
int[] arr; Person[] persons; Also support:
int arr[]; Person persons[];
(confusing, should be avoided) Creation^
int[] arr = new int[1024]; int [][] arr = { {1,2,3}, {4,5,6} }; Person[] persons = new Person[50];
arr
int[][] arr = new int [2][5];
arr[0]arr[1]
arr
copy value compare for equality
Even though it’s in a class definition, noinstance of the class exist when main startsexecuting
No parameter, default initialization (0/null) User can define their own^
The default one is gone
Different type, order, number… Return type is NOT enough
The Circle’s draw() method if the Shape objectis actually Circle, Square’s draw() if it’s actuallya Square O-O term: polymorphism