Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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?

Answer Posted / maverickhari

say me when this eill actually happen.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can we find the actual size of an object on the heap?

1316


Why is logger singleton?

1130


Can we have a method name same as class name in java?

1055


How infinite loop is declared?

1025


What are the differences between string and stringbuffer?

1129


What is var keyword ?

1191


What is the difference between delete and delete[]

1558


What is composition in java?

1295


please send me hr interview questions in it industry

2125


What is class??

1244


Why volatile is used in java?

1074


What are the steps that are followed when two computers connect through tcp?

995


What happens if we override only equals?

975


What is unicode datatype?

968


What is a default constructor and also define copy contrucyor?

1111