Considere o código Java abaixo:



import java.util.*;



public class ListaAnimaisSemGenerics {



public static void main(String[] args) {



int total = 0;



List lista = new LinkedList();



lista.add("Leão");



lista.add("Sapo");



lista.add("Cachoro");



System.out.println(lista);



for (int i = 0; i < lista.size(); i++){

total += (int) lista.get(i);

}



System.out.println(total);



}

}



Pergunta-se: Há um erro neste código? Se sim, ele ocorre em tempo de execução ou em tempo de compilação?

.
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Lista de comentários


More Questions From This User See All

Helpful Social

Copyright © 2025 ELIBRARY.TIPS - All rights reserved.