Can I declare class as static or private?



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

Post New Answer

More Core Java Interview Questions

What is string in java is it a data type?

1 Answers  


What is <> used for in java?

1 Answers  


Why synchronization is important in java?

1 Answers  


What are class members by default?

1 Answers   Hexaware,


Given a singly linked list, find the middle of the list in a single traversal without using temporary variable.

1 Answers   Fidelity,


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?

3 Answers   IBM, TCS,


What is type casting?

2 Answers  


How do you remove duplicates from an array in java?

1 Answers  


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?

1 Answers   MCN Solutions,


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?

6 Answers  


Mention a package that is used for linked list class in java.

1 Answers  


In a container there are 5 components. I want to display all the component names, how will you do that?

1 Answers  


Categories