1.

Which among the following is correct?(a) Private specifier must be used before public specifier(b) Private specifier must be used before protected specifier(c) Private specifier must be used first(d) Private specifier can be used anywhere in classI got this question in an internship interview.I need to ask this question from Private Access Specifier in portion Access Specifiers of Object Oriented Programming

Answer»

Correct CHOICE is (d) PRIVATE specifier can be used ANYWHERE in class

To explain I would say: The private specifier can be used anywhere in the class as required. It is not a rule to mention the private members first and then others. It is just FOLLOWED to write first for better readability.



Discussion

No Comment Found

Related InterviewSolutions