can we declare private class in java file?

Answer Posted / ranganathkini

A class can be marked by the "private" access specifier only
if its a nested member of another class.

Top level classes cannot be marked as "private". Hence you
can have private classes in a java file but they must be
nested inside another class.

Is This Answer Correct ?    208 Yes 16 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is hashcode calculated in java?

724


Why charat is used in java?

809


How do you declare an array that will hold more than 64KB of data?

918


Can we call the constructor of a class more than once for an object?

836


What is JVM and is it platform independent?

776


What is a singleton class? Give a practical example of its usage.

832


Implement two stacks using a single array.

790


What is a nested structure?

731


What is ph and buffers?

735


Which api is provided by java for operations on set of objects?

1195


Difference between keyword and identifier.

781


Which is bigger double or float?

731


Explain importance of inheritance in java?

783


What is difference between string and stringbuffer?

711


What are the two main uses of volatile in Java?

812