Error on finding the size of a char array in Java -


i'm starting java, , don't understand why code:

char words[][] = {"jazz", "buzz", "hajj", "fuzz", "jinx", "jazzy", "fuzzy", "faffs", "fizzy", "jiffs", "jazzed", "buzzed", "jazzes", "faffed", "fizzed", "jazzing", "buzzing", "jazzier", "faffing", "fuzzing"}; char comp[] = words[rand.nextint(words.length)]; char comphidden[comp.length]; 

produces error:

- syntax error on token "[", = expected - type mismatch: cannot convert int   char - syntax error on token "]", delete   token 

all on third line. why this? there way should find length of char array?

an assignment expected here, like:

char comphidden[] = new char[comp.length]; 

Comments