1.

Which among the following can be used for outermost class access specifier in java?(a) Private(b) Public(c) Default(d) Default or PublicI got this question by my school teacher while I was bunking the class.I need to ask this question from Public Access Specifier topic in chapter Access Specifiers of Object Oriented Programming

Answer» CORRECT choice is (d) Default or Public

The EXPLANATION: EITHER default or public access specifier must be used for outermost classes. Private can be used with inner classes. This is done so that all the members can access and use the utmost class and that program execution can be done from anywhere. Inner classes can be MADE private for security.


Discussion

No Comment Found

Related InterviewSolutions