why an outer class cannot be declared as private?



why an outer class cannot be declared as private?..

Answer / ravi kumar

private class PrivateClass //You cannot use private here
{
}


class TestClass //This is valid
{
}
}
This is because, in above example, if you declare PrivateClass as private then it's private to what? As Vijay said, it is of no use. So, intellisense intelligently doesn't show 'private' .

also another thing that private class can not be instantiate means u can not create object that class then what will be use of that class

Is This Answer Correct ?    5 Yes 0 No

Post New Answer

More Core Java Interview Questions

Can a java program have 2 main methods?

0 Answers  


what is the purpose of the wait(), notify(), and notifyall() methods? : Java thread

0 Answers  


What is hashtable and explain features of hashtable?

0 Answers  


What is difference between equals and hashcode method?

0 Answers  


Which of the following is not an isolation level in the JDBC

0 Answers   CTS,






Can we clone singleton class in java?

0 Answers  


How to find the size of an array a)array.length() b)array.length c)array.size() d)array.size

6 Answers   Accenture,


How much is a java license?

0 Answers  


How java is similar to c?

0 Answers  


Why packages are used?

0 Answers  


What are non-access modifiers?

2 Answers   Cognizant,


Can we define static methods inside interface?

0 Answers  


Categories