Submitted by: Octavia Anghel(octaviaanghel@gmail.com)

Thursday Apr 30th 2020 by Octavia Anghel
Article Image

Language: Java, Expertise: Intermediate: Learn how to clone a matrix in Java.

Cloning a matrix in Java can be done via the clone() method, as below:

int [][] arr = new int[matrix.length][];
for(int i = 0; i      arr[i] = matrix[i].clone();
Mobile Site | Full Site