Finishing a java object variable with null - Will it be removed from memory?

Asked

Viewed 27 times

1

public class TesteMemoria {

    public static void main(String... x){

        ASayboltFurolViscosity objeto;

        for (Double i = 30.0; i < 40.0; i++){

            objeto = new AlgoritmoASTMD2161_v1999_SSF(i, 
                    EnumTemperuraSSF.t122F_50C);

            System.out.println("Viscosidade SSF: " + i 
                    + "\tViscosidade cSt: " 
                    + objeto.toKinematicViscosity() + "\t" + objeto.toString() );

            objeto = null;

        }
    }
}

My question is whether assigning a null the variable 'object' will be removed from memory over time. And I take this opportunity to ask if you have how to know the position of the 'object' memory address within the JVM.

  • 2

    I believe the answers are yes and no.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.