I need to get the length of a 2D array for both the row and column. I’ve successfully done this, using the following code:
public class MyClass { public s
Java allows you to create "ragged arrays" where each "row" has different lengths. If you know you have a square array, you can use your code modified to protect against an empty array like this:
if (row > 0) col = test[0].length;