I have this situation. After the line c = null; in Example's main method, will the Collar object be bait for Garbage collection ?
Example.java is :
class Example{
public static void main(String[] args){
Collar c = new Collar();
Kit k = new Kit(c);
c = null;
//more code to keep the program running
}
}
Kit.java is :
class Kit{
Collar kit_col;
public Kit(Collar col){
kit_col = col;
}
}
Collar.java is :
class Collar{
public Collar(){
//nothing here
}
}