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 6556If all the methods in abstract class are declared as abstract then what is difference between abstract class and in interface?
8 12857How to validate the request (Eg:user name and password) in session(http session)? not in LDAP server ?
1 5130In C we use only compiler. Why java uses both compiler and interpreter? What is its significance?
5 16440wHAT IS DEFAULT SPECIFIER IN JAVA wHAT IS DEFAULT CONSTRUCTOR IN JAVA wHAT IS DEFAULT METHOD IN JAVA
IBM,
12 15886Write 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 8468
What are the four versions of java?
What does split function do in java?
How to sort numbers in java without array?
Difference between ‘is-a’ and ‘has-a’ relationship in java?
What is the difference between stringbuffer and stringbuilder class?
Which collection is sorted in java?
what is anonymous class in java?
what is optional in java 8?
how is final different from finally and finalize in java?
What is unicode with example?
How can we find the sum of two linked lists using stack in java?
What is skeleton and stub? What is the purpose of those?
What are packages in java?
Explain about strings in java?
Write a program to print the pattern given below