I am just starting to learn java, I am playing with using strings. I am trying to get a code to select a random word and print it.

Code:
public class test2 {

    public static void main(String[] args) {
    String[] wordListOne={"Dave","Nick","Paul","Mark","John","Bill","Gil"};
    int length1 = wordListOne.length();
    int rand1 = (int) (Math.random() * length1);
    String finalPhrase = wordListOne[rand1];
    System.out.println(finalPhrase);
  }
}
length() is not working and I am getting the error, "can not find symbol - method length()"