why are wait(), notify() and notifyall() methods defined in the object class? : Java thread
How to solve the problem of generating the unique hash keys with hash function?
What is proper subset?
Which variables are stored in stack?
What is natural ordering in java?
Java run-time system generates What class of exceptions?
Can we extend private class in java?
How do you ensure that n threads can access n resources without deadlock?
What is jar?
What are the methods to rectify ambiguities in the interfaces in JAVA?
Define interface?
How we can skip finally block of exception even if some exception occurs in the exception block in java?
public class Garbage { int a=0; public void add() { int c=10+20; System.out.println(c); System.out.println(a); } public static void main(String args[]) { Garbage obj=new Garbage(); System.gc(); System.out.println("Garbage Collected"); obj.add(); } } Above is a code in java used for garbage collection. object obj has been created for the class Garbage and system.gc method is called. Then using that object add method is called.System.gc method if called the obj should be garbage collected?