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

How do we make a class serialize?

3 Answers   Syntel,


What is JAVA? Why it is platform independent?

10 Answers   NIIT,


Why sleep()is in Thread and wait() in Object class? Why can't I have both in one class or vice versa?

1 Answers  


What is t in generics in java?

0 Answers  


Why do we need autoboxing in java?

0 Answers  


What is unicode datatype?

0 Answers  


What is prefix of a string?

0 Answers  


Are nested try statements are possible?

2 Answers  


How u dubugg ur project?

1 Answers   iFlex,


Can we declare a static variable inside a method?

0 Answers  


Can you add null to a list java?

0 Answers  


what is meant wrapper classes?

0 Answers  


Categories