Can we synchronize static methods in java?
No Answer is Posted For this Question
Be the First to Post Answer
how to create an applet
Can string be considered as a keyword?
How do you remove spaces in java?
Mention the default values of all the elements of an array defined as an instance variable.
What is codebase?
what is template design pattern?
What is stack example?
What is java command?
Which sort is best in java?
What are the restriction imposed on a static method or a static block of code?
Can I declare class as static or private?
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?