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 8025If all the methods in abstract class are declared as abstract then what is difference between abstract class and in interface?
8 14727How to validate the request (Eg:user name and password) in session(http session)? not in LDAP server ?
1 5833In C we use only compiler. Why java uses both compiler and interpreter? What is its significance?
5 17982wHAT IS DEFAULT SPECIFIER IN JAVA wHAT IS DEFAULT CONSTRUCTOR IN JAVA wHAT IS DEFAULT METHOD IN JAVA
IBM,
12 19015Write 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 9622
What is character in data type?
How many bytes are a float?
what is the purpose of the wait(), notify(), and notifyall() methods? : Java thread
What is the purpose of assert keyword used in jdk1.4.x?
What is the benefit of inner classes in java?
Can we force the garbage collection to run?
what methods would you overwrite in java.lang.object class?
What is string intern in java?
What is the size of int?
Differentiate between run time error and syntax error.
What is the char data type?
Can a class be private or protected in java?
What is difference between == and === in js?
How can you set an applet’s height and width as a percentage?
Why we do exception handling in java and how many types of exceptions are there?