Click here to watch in Youtube :
https://www.youtube.com/watch?v=HZpOJzSfws0&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java how to unreference an Object |
Java Tutorial : Java how to unreference an Object |
Java Tutorial : Java how to unreference an Object |
Java Tutorial : Java how to unreference an Object |
public class Student { String name; int age; public Student(String name, int age) { this.name = name; this.age = age; } }
public class StudentTest { public static void main(String[] args) { Student johnReferenceVariable = new Student("John", 25); johnReferenceVariable = null; // now the object referred by // johnReferenceVariable is available // for garbage collection Student ref1 = new Student("Juli", 25); Student ref2 = new Student("Dave", 29); ref1 = ref2; // now the first object referred by ref1 is available for // garbage collection. new Student("Peter", 28); } }
https://sites.google.com/site/javaee4321/java/UnreferenceObjectDemoApp.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/UnreferenceObjectDemoApp/UnreferenceObjectDemo
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/68054fa19b88e552162495a83ba964283753af15/BasicJava/UnreferenceObjectDemoApp/UnreferenceObjectDemo/?at=master
See also:
No comments:
Post a Comment