Caro colega,
 
 
estou estudando tb para a prova de certifica��o programador Java e nos meus estudos vejo que a resposta para esta quest�o � a:

d - there is no way to tell

pois n�o ï¿½ poss�vel determinar quando o coletor de lixo de mem�ria entrar� em a��o, e ainda n�o podemos for�ar sua execu��o. 

 

 

-----Mensagem original-----
De: jose soares sobrinho [mailto:[EMAIL PROTECTED]]
Enviada em: quarta-feira, 15 de maio de 2002 21:33
Para: [EMAIL PROTECTED]
Assunto: [java-list] D�vida

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!

Responder a