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 |
Which non-unicode letter characters may be used as the first character of an identifier?
how to handle exceptions in ejb?
What is not thread safe?
explain the difference between jdk and jvm?
Why do we need public static void main(String args[]) method in Java...?
How do you identify if jvm is 32-bit or 64-bit from java program?
What is an Applet ?
What is try-with-resources in java?
I want my class to be developed in such a way that no other class (even derived class) can create its objects. Define how can I do so?
Can a class be final?
Which list is sorted in java?
What is nested top-level class?