When should we create our own custom exception classes?
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 is the difference between inner class and nested class?
What is the difference between state-based unit testing and interaction-based unit testing?
What does %d do in java?
What does replaceall do in java?
Is singleton set an interval?
What is size () in java?
Can we define constructor in inner class?
What is a static class in java?
What is the file type?
How to create a base64 decoder in java8?
Break statement can be used as labels in java?