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

What is “try and catch” in java

5 Answers   Cap Gemini, TCS,


Is singleton a bad practice?

0 Answers  


Is string pool garbage collected?

0 Answers  


What is the function of compareto in java?

0 Answers  


why java uses class level type casting ?

0 Answers  






Which is better singleton or static class?

0 Answers  


What is method reference in java?

0 Answers  


what is the difference b/w PUT and POST method to send data to the server

5 Answers   Mind Tree,


What access modifiers can be used for methods?

0 Answers  


What is run-time class and system class? what is their purpose?

1 Answers  


What is a control variable example?

0 Answers  


What data type is a string?

0 Answers  


Categories