Can an object be garbage collected while it is still
reachable?
Answers were Sorted based on User's Feedback
Answer / ravikiran(aptech mumbai)
yes...all the garbage ollection things depends on the
garbage collector of JVM
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / sudheer
Garbage collector is a low priority thread. We cant order to delete an object. When the object has no references and object which are out of scope will be deleted by the garbage collector to free the memory. So when an object is reachable it cant be garbage collected.
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / janet
Once an object is garbage collected, it ceases to exist. It
can no longer become reachable again.
| Is This Answer Correct ? | 0 Yes | 3 No |
In a class implementing an interface, can we change the value of any variable defined in the interface?
What are annotations in java?
Explain about oops concepts.
0 Answers Aditi Placement Service,
What are the different ways of implementing thread? Which one is more advantageous?
Is nan false?
How can final class be used?
What is variable explain?
interface X{ void m1(); void m2(); } class Child2 extends Object implements X { public void m1(){ System.out.println("Child2 M1"); } public void m2(){ System.out.println("Child2 M2"); } } public class ParentChildInfterfaceDemo { public static void main(String[] args){ X x = new Child2(); X x1 = new Child2(); x.m1(); x.m2(); x.equals(x1); } } Will the above code work? If yes? Can you please explain why the code x.equals(x1) will work as the equals method is called on interface reference vaiable?
When we should use serialization?
What is user defined exception in Java?
explain System.out.println()
What is class??