Bruno, Segundo a quest�o, o que est� sendo lan�ado � um error (OutOfMemoryError). Portanto, penso que a quest�o "F" � que estaria correta.
A classe Error extende a classe Throwable, e por isso o erro seria capturado pelo "finally". Depois disso, caso o erro n�o for tratado, o programa ir� "bombar". Mas at� l� j� teria impresso "Carrying on". []'s Ruy Pedroso Trails Sistemas Av. Nilo Pe�anha 50 - sala 2511 - Centro CEP 20020-100 - Rio de Janeiro - RJ Tel: +55 21 2262 6370 Fax: +55 21 2262 6354 -----Original Message----- From: Bruno do Amaral Dias Baptista [mailto:[EMAIL PROTECTED]] Sent: segunda-feira, 3 de fevereiro de 2003 02:22 To: Java List Subject: Re: [java-list] D�vida sobre Exceptions Fala. Lembre-se que a classe Exception eh a classe "pai" de todas as excecoes! Logo, a resposta eh D, E e F. ETA. Bruno do Amaral. On Wed, 29 Jan 2003, Caetano wrote: > Ol� Pessoal, > > Estudando um pouco de exce��es, me deparei com uma quest�o que n�o soube > responder, at� porque n�o consigo simular ela: > Acredito que a(s) poss�veis respostas sejam as letras E e F. Conto com a > ajuda de voc�s. > > 8. Consider the following class hierarchy and code fragment: > > java.lang.Throwable --> java.lang.Error --> java.lang.OutOfMemoryError > | > | > --> java.lang.Exception --> java.io.IOException > | > | > --> > java.net.MalformedURLException > | > | > --> > java.io.StreamCorruptedException > > 1. try { > 2. // assume s is previously defined > 3. URL u = new URL(s); > 4. // in is an ObjectInputStream > 5. Object o = in.readObject(); > 6. System.out.println("Success"); > 7. } > 8. catch (MalformedURLException e) { > 9. System.out.println("Bad URL"); > 10. } > 11. catch (StreamCorruptedException e) { > 12. System.out.println("Bad file contents"); > 13. } > 14. catch (Exception e) { > 15. System.out.println("General exception"); > 16. } > 17. finally { > 18. System.out.println("Doing finally part"); > 19. } > 20. System.out.println("Carrying on"); > > What lines are output if the method at line 5 throws an OutOfMemoryError? > > A. Success > B. Bad URL > C. Bad file contents > D. General exception > E. Doing finally part > F. Carrying on. > > > ------------------------------ LISTA SOUJAVA ---------------------------- > http://www.soujava.org.br - Sociedade de Usu�rios Java da Sucesu-SP > d�vidas mais comuns: http://www.soujava.org.br/faq.htm > regras da lista: http://www.soujava.org.br/regras.htm > historico: http://www.mail-archive.com/java-list%40soujava.org.br > para sair da lista: envie email para [EMAIL PROTECTED] > ------------------------------------------------------------------------ - > ------------------------------ LISTA SOUJAVA ---------------------------- http://www.soujava.org.br - Sociedade de Usu�rios Java da Sucesu-SP d�vidas mais comuns: http://www.soujava.org.br/faq.htm regras da lista: http://www.soujava.org.br/regras.htm historico: http://www.mail-archive.com/java-list%40soujava.org.br para sair da lista: envie email para [EMAIL PROTECTED] ------------------------------------------------------------------------ - --- Incoming mail is certified Virus Free.O email foi inspecionado por v�rus. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 27/1/2003 --- Outgoing mail is certified Virus Free.O email foi inspecionado por v�rus. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.449 / Virus Database: 251 - Release Date: 27/1/2003 ------------------------------ LISTA SOUJAVA ---------------------------- http://www.soujava.org.br - Sociedade de Usu�rios Java da Sucesu-SP d�vidas mais comuns: http://www.soujava.org.br/faq.htm regras da lista: http://www.soujava.org.br/regras.htm historico: http://www.mail-archive.com/java-list%40soujava.org.br para sair da lista: envie email para [EMAIL PROTECTED] -------------------------------------------------------------------------
