After your copyAll method executes, the array array2 should have the contents {2, 1, 4, 3, 6, 5}, just like array1.
You may assume that the second array always contains at least as many elements as the first array.
Also try writing a variation of this method that accepts only one array as a parameter and returns the copied array.
Inside the method, create a second array of numbers to hold the copy and return it.
After your copyAll method executes, the array array2 should have the contents {2, 1, 4, 3, 6, 5}, just like array1.You may assume that the second array always contains at least as many elements as the first array.Also try writing a variation of this method that accepts only one array as a parameter and returns the copied array.Inside the method, create a second array of numbers to hold the copy and return it.
การแปล กรุณารอสักครู่..

หลังจากที่วิธีการดำเนินการของคุณ copyAll, array2 อาร์เรย์ควรจะมีเนื้อหา {2, 1, 4, 3, 6, 5} เช่นเดียว array1. คุณอาจจะคิดว่าแถวที่สองมักจะมีอย่างน้อยองค์ประกอบมากที่สุดเท่าที่อาเรย์เป็นครั้งแรกนอกจากนี้ยังพยายามเขียนรูปแบบของวิธีการที่ยอมรับเพียงหนึ่งอาร์เรย์เป็นพารามิเตอร์และส่งกลับอาร์เรย์คัดลอกนี้. ภายในวิธีการสร้างอาร์เรย์ที่สองของตัวเลขที่จะถือการคัดลอกและมันกลับมา
การแปล กรุณารอสักครู่..

หลังจากวิธี copyall ของคุณรัน , เรย์ array2 ควรมีเนื้อหา { 2 , 1 , 2 , 3 , 4 , 5 } , เหมือน array1
คุณอาจสันนิษฐานว่า อาร์เรย์ที่สองมักจะมีอย่างน้อยเป็นหลายองค์ประกอบเป็นอาร์เรย์แรก
ก็ลองเขียนเป็นรูปแบบของวิธีนี้ว่า ยอมรับ เดียว เรย์เป็นพารามิเตอร์และค่าลอกเรย์
ภายในวิธีสร้างอาร์เรย์ที่สองของตัวเลขที่จะถือสำเนา และส่งคืน
การแปล กรุณารอสักครู่..
