I have the following piece of code in java.
String[] words = {"House","School","Name"} ;
for(int i = 0; i < words.length; i++){
int randomChars = random.nextInt(lengthOfText);
System.out.println("randomChars" + randomChars);
char[] currentChars = words[i].toCharArray();
}
I have learned that an array is not dynamic. The length is static. But here in this code the length of the char array increase and lastly decrease. Can someone explain me this behavior?
Please login or Register to submit your answer