extending thread class or implementing runnable interface. Which is better? : Java thread
Real Time sample code for Encapsulation and Abstraction. where to use abstract and where to use specifies like public private.
What is the use of optional ?
What is a generic type?
what is request dispatcher and how does it work?
What is the use of beaninfo?
What is one third plus one third as a fraction?
How a string is stored in memory?
What is the difference between == and === javascript?
What does void * mean?
What is the difference between choice and list?
what is use of session tracking ?with example?
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?