For getting indivisual elements of the array follow below code :-
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
Scanner scanner = new Scanner(System.in);
char [][] gameboardTwo = {
{'*', '*', 'S', 'T', 'A','R', '*', 'W', 'A', 'R', 'S', '*', '*', '*'},
{'*', '*', 'E','P', 'I', 'S', 'O', 'D', 'E', '*', '*', 'I', 'V', '*'},
{'*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*'},
{'*', '*', '*','*', '*', '*', '*', '*', '*', '*', '*', '*', '*', '*'}
};
System.out.println(Arrays.deepToString(gameboardTwo));
System.out.println("////////////////////////////");
System.out.println(gameboardTwo[0].length);
System.out.println("////////////////////////////");
for(int i=0; i<4; i++){
for(int j=0; j<14; j++){
System.out.println(gameboardTwo[i][j]);
}
System.out.println("**** row ends ****");
}
}
No comments:
Post a Comment