Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erro ao fazer o cast do elemento - GenericsExempleList #53

Open
pauloheidenreich opened this issue May 1, 2024 · 2 comments
Open

Erro ao fazer o cast do elemento - GenericsExempleList #53

pauloheidenreich opened this issue May 1, 2024 · 2 comments

Comments

@pauloheidenreich
Copy link

Ao rodar o exemplo da classe GenericsExempleList, a IDE apontou uma exception ao fazer o cast do valor do elemento do tipo "Int" para o tipo String, lançando a ClassCastException. Neste caso, eu poderia ao invés de fazer o cast, eu poderia chamar o método toString() ? Ou dependendo do tipo poderia gerar o mesmo erro ?

Screenshot from 2024-05-01 17-04-43

@cami-la
Copy link
Owner

cami-la commented May 6, 2024

Oi, @pauloheidenreich. Tudo certinho? Poderia me mostrar a mensagem da exception? Seria mesmo uma exception ou um warning?

Aqui eu tirei uma dúvida do colega sobre o Casting, veja se ajuda: #23 (comment)

Veja se ajuda. Qualquer dúvida, é só falar.

@pauloheidenreich
Copy link
Author

Boa noite Camila, segue print:

Screenshot 2024-05-06 212701

No caso o que fiz pra rodar foi:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants