How to make a write-only class in java?
No Answer is Posted For this Question
Be the First to Post Answer
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 base class of all exception classes?
What happens if main method is not static?
What is anonymous class?
What is method overriding in java ?
what is difference between length and length()?
Why we use set in java?
How can you generate random numbers in java?
What is a Wrapper class?
Is map sorted in java?
Which is bigger double or float?
How to reduce flicking in animation?