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?
6 8422If all the methods in abstract class are declared as abstract then what is difference between abstract class and in interface?
8 15216How to validate the request (Eg:user name and password) in session(http session)? not in LDAP server ?
1 5988In C we use only compiler. Why java uses both compiler and interpreter? What is its significance?
5 18336wHAT IS DEFAULT SPECIFIER IN JAVA wHAT IS DEFAULT CONSTRUCTOR IN JAVA wHAT IS DEFAULT METHOD IN JAVA
IBM,
12 19831Write java code to print "Hello how are you" Thread1 should have "Hello" Thread2 should have "how are you" both the threads should start at the same time
4 9942
Is oracle java 11 free?
What is the difference between @before and @beforeclass annotation?
What is this keyword in java?
What is module in project?
What is hash table in java?
What are sets in java?
What are the rules for naming an array?
What's the purpose of static methods and static variables?
What modifiers are allowed for methods in an interface?
Have you ever used hashtable and dictionary?
What environment variables do I need to set on my machine in order to be able to run java programs?
we have syntax like for(int var : arrayName) this syntax is to find whether a number is in the array or not.but i want to know how to find that number's location.
Is assembly language a low level language?
What is overriding in java?
What causes memory leaks in java?