Latest Tutorials| Questions and Answers|Ask Questions?|Site Map


View Questions and Answers by Category


Have Programming Question? Ask it here!

Java reference
1 Answer(s)      4 years and 2 months ago
Posted in : Java Interview Questions

What is weak reference in Java?

View Answers

October 22, 2010 at 11:32 AM


Here is the answer.

An object is weakly reachable when the garbage collector finds no strong or soft references but at least one path to the object with a weak reference.

A weak reference is one that does not prevent the referenced object from being garbage collected. Weakly reachable objects are finalized some time after their weak references have been cleared.

A weak reference is a reference that does not keep the object it refers to alive. A weak reference is not counted as a reference in garbage collection. If the object is not referred to elsewhere as well, it will be garbage collected.


Related Tutorials/Questions & Answers:
Java reference
Java reference  What is weak reference in Java
Is Java pass-by-reference?
Is Java pass-by-reference?  Is Java pass-by-reference
pass method reference in java
pass method reference in java  How to pass method reference in Java
Java interface reference
Java interface reference  When can an object reference be cast to an interface reference
Reference passing in java
Reference passing in java  plz tell me wat d meaning of refernce in java? for example : Class M(){ N n; } Class N(){ } wats dis meaning
Pass by Reference - Java Beginners
by Reference?can u please explain with java supports Pass by reference...); } } Java programming language does not pass objects by reference...(i); display(i); } } Pass By Reference: It refers to pass an object
difference between hashcode,reference in java
difference between hashcode,reference in java  difference between hashcode,reference in java
java pass by reference
java pass by reference  i understood java always pass arguments by pass by value so that the original value does not change...... but i want to know how we change the value and make it effect the original value by passing
java call by reference - Java Beginners
affect the caller?s original variables. Java never uses call by reference. call by reference  in java do we have ane term like call by reference. if yes give me the full description with example and if no then also
pass by value /reference - Java Beginners
pass by value /reference  hello sir/mam, i know pass by value is a primitive type in java. what about pass by reference in java ? .. For object type pass by value is used or pass by reference is used ? pls give me a example
reference of student into person can do like this or any other alternative Student
Java simple reference source - Java Beginners
Java simple reference source  Hi, please could you recommend me a Java simple reference source (on line or e-book) where I could quickly find... would like to have a Java reference source for a quick look. I have got some
Reference type Vs Object type. - Java Beginners
Reference type Vs Object type.  Can anyone explain the exact difference between Reference and Object, how can i create a reference ? When exactly we have to use reference. Is this both terms interchangeble. Thanks
how do you parse by reference in java(with JGrasp)
how do you parse by reference in java(with JGrasp)  i am a 1st year beginner in java programming(GR 10) at hillcrest High School in south Africa My question is how do you parse by reference in java(with JGrasp) please help me i
difference between the obj and reference - Java Beginners
difference between the obj and reference  what is the difference between object and reference ? is there any difference
Reference Data Types
In this section we will discuss about Reference Data Types in Java 7
cross reference
cross reference   hi everbody as i got a problem and i have no idea the problem that i need to create a cross reference map for a Java source file. detail show below it mean that the input to the program is a Java source
by value or by reference
by value or by reference  Are objects passed by value or by reference
appdelegate reference
appdelegate reference  Hi, How to get the reference of appdelegate in my view controller class. Thanks.   Hello Friend, Following code example show how to get appdelegate reference anywhere in your iPhone/iPad
Java Reference Books
Java Reference Books      ....     Java Reference Guide In the Java Reference Guide this week I present an MXBean monitoring Servlet
pointer to a reference
pointer to a reference  pointer to a reference in C++    #include <iostream> using namespace std; void foo1(int& x) { int* p = &x; *p = 123; } void foo2(int* x) { int
pointer to a reference
pointer to a reference  pointer to a reference in C++    #include <iostream> using namespace std; void foo1(int& x) { int* p = &x; *p = 123; } void foo2(int* x) { int
Reference Data Types
Data Types in brief In Java a reference data type is a variable that can... is called reference types in Java. The object becomes an instance when... are reference types because these are treated as objects in Java. For example
Are objects passed by value or by reference?
Are objects passed by value or by reference?  Are objects passed by value or by reference
call by reference - Development process
call by reference. Java always uses call by value. import java.awt.*; by reference  Hello , Is thre callbyvalue in java... cannot change the caller?s reference variables, i.e. make them point to different
Declare Reference variable
Declare Reference variable   class A { int a; //instance... is shared. I just want to ask if we declare Reference variable above then what does...?? (Generally we used to declare reference variable in main method at the time
JSF core Tag Reference
JSF Core Tag Reference          This section is dedicated to make you understand about JSF Core Tags. All these core tags are contained in JSF Core Tag Library
Object reference not set to an instance of an object
Object reference not set to an instance of an object  Object reference not set to an instance of an object
Struts Reference
Struts Reference Welcome to the Jakarta Online Reference... Project. Here we are providing you detailed Struts Reference. This online struts reference covers Struts Model-View-Controller (MVC) concepts, configuring and using
XML error message: The reference to entity
XML error message: The reference to entity   XML error message: The reference to entity "ai" must end with the ';' delimiter. Im getting this error when i gotta edit my blogger template Please advice manjunath
PHP Call By Reference
PHP Call By Reference: In PHP we can pass reference of a variable, so that we... values from where we have sent. It is much like the call by reference, in which we... function. PHP Call By Reference Example: <?php function swap(&