If the argument is null, the length is anything other than 6, or if the element values are outside the inclusive bound of 1 to 7 throw the IllegalArgumentException with the message "Invalid parameter". Otherwise return a char array that has input[0] instances of 'Q', followed by input[1] instance of 'W', ....followed by input[5] instances of 'Y'. The length of the returned array should be the exact size needed to accommodate all the letters (no smaller or larger)
This is what I have so far:
public static char[] QWERTY (int [] input) {
if((input == null) || (input.length > 6))
{
throw new IllegalArgumentException("Invalid parameter");
}
else
return null;
}
I just need the else condition
Aucun commentaire:
Enregistrer un commentaire