Declaring a two-dimensional array is interesting in Java as Java programming language provides many ways to declare a 2D array and each way have some special things to learn about. For example, It's possible to create a two-dimensional array in Java without specifying the second dimension, sounds crazy right? but it's possible because two-dimensional array in Java is nothing but an array of array. You can even create a two-dimensional array where each subarray has different length or different type, also known as a heterogeneous array in Java. Some of the ways described here also apply how you to declare one-dimensional array e.g. changing the place of square brackets and it has implication on any other variables declared in the same line.
Read more »
No comments:
Post a Comment