A resposta certa eh a 'd'

        Todos os strings q foram criados dentro do escopo do 'for' (os 10 strings contendo "1", "2", "3, "4", "5"..."10") jah estao fora de escopoe sem referencias, logo sao CANDIDATOS a garbage collection.. Mas nao ha como dizer QUANDO serao coletados.
        System.gc() "estimula" uma coleta de lixo, mas nao faz com que aconteca imediatamente.


[]s


At 21:32 15/5/2002 -0300, you wrote:
Mailing-List: contacte [EMAIL PROTECTED]; gerenciado pelo ezmlm
X-No-Archive: no
List-Help: <mailto:[EMAIL PROTECTED]>
List-Unsubscribe: <mailto:[EMAIL PROTECTED]>
List-Subscribe: <mailto:[EMAIL PROTECTED]>
List-Post: <mailto:[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Delivered-To: mailing list [EMAIL PROTECTED]
Delivered-To: moderator for [EMAIL PROTECTED]
Date: Wed, 15 May 2002 21:32:31 -0300 (ART)
From: jose soares sobrinho <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: [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!

-------------------------------------------------
----------- Herval Freire de A. Júnior ----------
----------- mailto:[EMAIL PROTECTED] ------------
--------- http://www.herval.hpg.com.br ----------
----------------- UIN: 2067270 ------------------
-------------------------------------------------
--[The adepts are everywhere... awake! v0.666a]--
-------------------------------------------------

“First they ignore you
 Then they laugh at you
 Then they fight you
 Then you win”
  -- Mahatma Gandhi

Responder a