Can I declare class as static or private?
Answer / Santosh Kumar Bharati
Yes, a class in Java can be declared as static but not as private. Static classes are used when the instance of the class is not required.
| Is This Answer Correct ? | 0 Yes | 0 No |
What is string in java is it a data type?
What is <> used for in java?
Why synchronization is important in java?
What are class members by default?
Given a singly linked list, find the middle of the list in a single traversal without using temporary variable.
My application URL : http://localhost:8080/Application/Login.jsp. When a user enter this url in IE then, how it get Login.JSP Page exactly? what are the processes will happen from when we submit the URL to get Login.jsp?
What is type casting?
How do you remove duplicates from an array in java?
In a program, initializing an array of 100 KB is throwing an out of memory exception while there is 100 MB of memory available. Why?
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?
Mention a package that is used for linked list class in java.
In a container there are 5 components. I want to display all the component names, how will you do that?