Can I declare class as static or private?
No Answer is Posted For this Question
Be the First to Post Answer
What is a constructor, constructor overloading in java?
Scenario: There are 1 to 100 numbers. Each number should be keep in the each column like from A column to Z column ie 1 to 26. From 27 to 52 should be in 2nd row in the excel sheet. This has to be continue till 100. How do you write Java program and what are various methods.
Write a regular expression to validate a password. A password must start with an alphabet and followed by alphanumeric characters; its length must be in between 8 to 20.
Can an integer be a string?
How to add panel to a Frame?
difference throws and throw in java
Difference between a MenuItem and a CheckboxMenuItem?
What is the arraylist in java?
Where are global variables stored?
Why do we need singleton?
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?
How hashmap increases its size in java?