So I'm just playing around with a 2-D String array here and wanted to see how my output varies if I just print out only the row dimension of my actual array. Following is my code with the strange output.
public class TwoDimensionalArrays {
public static void main(String[] args) {
String[][] words = { { "Hello", "Mr.", "Spencer!" }, { "How", "Are", "You", "Doing", "Today?" },
{ "I", "recommend", "an", "outdoor", "activity", "for", "this", "evening." }
};
for (int m = 0; m < words.length; m++) {
for (int n = 0; n < words[m].length; n++) {
System.out.println(words[m]);
}
}
}
Output:
[Ljava.lang.String;@7852e922
[Ljava.lang.String;@7852e922
[Ljava.lang.String;@7852e922
[Ljava.lang.String;@4e25154f
[Ljava.lang.String;@4e25154f