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]
-------------------------------------------------------------------------