i need this code in java please declare an 2D array ofcharacters and search for a char sequence(creating a word ) in rowsonly (horizontaly ) Example 2D array , the word Input:CAT
A B C D E
A C A T N
G H I C T
L M C A T
output:Found Word “CAT” Row 1 col 1 and row 3 col 2
i solve it like that but nothing is outputed i need to know whatis wrong and how to solve it
for(int i=0;i<wordpuzzle.length;i++)
{ for(int j=wordpuzzle[i].length;i<0;j++)
{
if(wordpuzzle[i][j].equals(word.charAt(index)))
{
temp+=wordpuzzle[i][j];
index++;
}
if(temp.equals(word))
{
System.out.print(“Found at row”+i+”col”+j);
}
}
Expert Answer
An answer will be send to you shortly. . . . .