java int鏁扮粍鎷疯礉鎬庝箞瀹炵幇
瑕佸疄鐜癑ava涓璱nt鏁扮粍鐨勬嫹璐濓紝鍙互閫氳繃浠ヤ笅涓ょ鏂规硶锛?/p>
鏂规硶涓€锛氫娇鐢ˋrrays绫荤殑copyOf()鏂规硶
int[] sourceArray = {1, 2, 3, 4, 5};
int[] targetArray = Arrays.copyOf(sourceArray, sourceArray.length);
鏂规硶浜岋細浣跨敤System绫荤殑arraycopy()鏂规硶
int[] sourceArray = {1, 2, 3, 4, 5};
int[] targetArray = new int[sourceArray.length];
System.arraycopy(sourceArray, 0, targetArray, 0, sourceArray.length);
鏃犺鏄娇鐢ˋrrays.copyOf()鏂规硶杩樻槸System.arraycopy()鏂规硶锛岄兘鍙互瀹炵幇int鏁扮粍鐨勬嫹璐濄€備娇鐢ㄥ摢绉嶆柟娉曞彇鍐充簬涓汉鐨勫亸濂藉拰鍏蜂綋闇€姹傘€?/p>
相关问答