Home > Back-end >  Memory allocation chart, the best is drawing tools to draw out! The small white for help ~!
Memory allocation chart, the best is drawing tools to draw out! The small white for help ~!

Time:10-03

Package collection;

import java.util.Arrays;

Public class Test2 {
Public static void main (String [] args) {
Int a=1;
String STR="hello".
Point p=new Point (1, 2);
String [] arr={" one ", "two", "three", STR};
Int [] arr1={1, 2, 3, 4, a};
Point [] arr2={new Point (1, 2), new Point (3, 4), new Point (5, 6), p};

Dosome (a, STR, p, arr, arr1, arr2);
System. The out. Println (" a: "+ a);
System. The out. Println (" STR "+ STR);//hello,
System. The out. Println (", "p + p).
System. The out. Println (" arr: "+ Arrays. ToString (arr));
System. The out. Println (" arr1: "+ Arrays. ToString (arr1));
System. The out. Println (" arr2: "+ Arrays. ToString (arr2));
}

Public static void dosome (int a, String STR, Point p, String [] arr, int [] arr1, Point [] arr2) {
[a] arr1=3;//arr1 [1]=3
Arr [a]="STR";
Arr a + [1]=STR;
STR="world";
STR=arr [2].
STR +="!!!!! ";
P. etX (4);
P=arr2 [2].
P. etX (6);
Arr2=Arrays. CopyOf (arr2, arr2. Length - 1);
Arr2 [2]. Your setX (8);
Arr2=new Point [] {new Point (2, 2), p};
Arr2 [arr2 length - 1]. Your setX (12);
}
}
  • Related