What is vector?
How many arguments can a method have java?
What is the importance of static variable?
What is immutable state?
Explain illegalmonitorstateexception and when it will be thrown?
Is there any use of an abstract class which has no methods and no attributes?
What's the difference between int and integer in java?
Can we create a class inside a class in java?
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?
What are the differences between heap and stack memory in java?
How can constructor chaining be done by using the super keyword?
Can we add default constructor to Servlet?
JVM is platform independent or depeneded?