Feel stupid asked like the exact same question yesterday but today with a different situations can do the same thing.
single[z][i] = (board[i].split("?!^"));
This line gives me an error: incompatible types required: String found: String[] 1 error I know it because its a 2D array and split gives it own string output but dont know how to fix. Here is all my code:
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int player;
String board[] = new String[8];
String single [] [] = new String [8] [8];
//single[0][0] = "hi";
//If player is 1, I'm the first player.
//If player is 2, I'm the second player.
player = in.nextInt();
//Read the board now. The board is a 8x8 array filled with 1 or 0.
for(int i = 0; i < 8; i++) {
if(in.hasNext()){
board[i]= in.next();
}
}
for(int z = 0; z < 8; z++){
for(int i = 0; i < 8; i++) {
single[z][i] = (board[i].split("?!^"));
}
}for(int z = 0; z < 7; z++)
for(int i = 0; i < 7; i++) {
if((single[z][i].equals(1)) && (single[z][i+1].equals(1)) &&(single[z+1][i].equals(1))){
System.out.print(z + ""+ i);
}
}
nextMove(player,board);
}
}