I'm trying to figure out how to print a two-dimensional array by column. This is what I have so far:
public class Orwell2 {
public static void main(String[] args) {
char[][] orwell = {
{'I', 't', '*', 'w', 'a', 's', '*'},
{'a', '*', 'b', 'r', 'i', 'g', 'h'},
{'t', '*', 'c', 'o', 'l', 'd', '*'},
{'d', 'a', 'y', '*', 'i', 'n', '*'},
{'A', 'p', 'r', 'i', 'l', ',', '*'},
{'a', 'n', 'd', '*', 't', 'h', 'e'},
};
for (char a = 0; a < orwell.length; a++) {
for (char b = 0; b < orwell[0].length; b++) {
System.out.print(orwell[a][b] + " ");
}
System.out.println();
}
}
}
I need to print the array as
IatdAat apn bcyrdwro i aililtsgdn,h h e
Edit: Just so everyone knows, I have absolutely no idea what I'm doing.