public void adiciona (String elemento) throws Exception{
if (tamanho < elementos. length) {
elementos [tamanho] = elemento;
tamanho++;
else
throw new Exception ("Vetor já está cheio, não é possível
adicionar mais elementos"):
}
}
To embed this program on your website, copy the following code and paste it into your website's HTML: