A resposta correta � a letra D - there is no way to tell
pois o gc � uma thread de baixa prioridade e n�o �
possivel precisar a que momento os objetos ser�o
removidos, repare bem no enunciado da qest�o ele
pergunta:
When the program reaches line 7, how many of the
String objects created in line 3 will have been garbage
collected?
Abra�os, Marcelo Sousa Ancelmo.
> Acho que s�o 11 objetos que a System.gc() ir�
recolher, pois o la�o
> for tem 11 itera��es e, em cada itera��o � criado um
objeto String.
>
> jose soares sobrinho wrote:
>
> >
> >
> > Ol� lista
> >
> > Estou estudando para certifica��o e; podes , de
forma did�tica,
> > responder-me esta quest�o? Portuguese please ;)
> >
> > Here is a method that creates a number of String
objects
> >
> > in the course of printing a countdown sequence:
> >
> > 1. public void countDown()
> >
> > 2. for( int i = 10 ; i >= 0 ; i-- ){
> >
> > 3. String tmp = Integer.toString( i );
> >
> > 4. System.out.println( tmp );
> >
> > 5. }
> >
> > 6. System.gc()
> >
> > 7. System.out.println( BOOM! );
> >
> > 8. }
> >
> > When the program reaches line 7, how many of the
> >
> > String objects created in line 3 will have been
garbage
> >
> > collected? Assume that the System.out object is not
keeping
> >
> > a reference.
> >
> > RESPOSTA
> >
> > a - nome
> >
> > b - 11
> >
> > c - 10
> >
> > d - there is no way to tell
> >
> >
> >
> > )) []s, Soares http.vivavida!com
> > C|~~|
> > .`--' http.macrosoft.tbm
> >
> >
> > -----------------------------------------------------
------------------
> > Yahoo! Encontros
> > O lugar certo para voc� encontrar aquela pessoa que
falta na sua vida.
> > Cadastre-se hoje mesmo!
>
> --
> Nilo Garcia Silveira
> Estagi�rio
>
> Visual Systems Informatica Ltda.
> Oracle Partner Program
> http://www.visualsystems.com.br
> Tel: (17) 2124425 R. 31
>
> As afirma��es e opini�es expressadas aqui s�o de minha
total
> responsabilidade e n�o representa,
> necessariamente, opini�es ou declara��es feitas pela
Visual Systems
> Inform�tica Ltda.
>
>
__________________________________________________________________________
Quer ter seu pr�prio endere�o na Internet?
Garanta j� o seu e ainda ganhe cinco e-mails personalizados.
Dom�niosBOL - http://dominios.bol.com.br
------------------------------ 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]
-------------------------------------------------------------------------