1.

In java, which rule among the following is applicable?(a) Keyword public can’t be preceded with all the public members(b) Keyword public must be preceded with all the public members(c) Keyword public must be post mentioned the function declaration(d) Keyword public is not mandatoryI have been asked this question in an internship interview.My question is based upon Public Member Functions in chapter Member Functions & its Types of Object Oriented Programming

Answer»

The correct ANSWER is (b) Keyword PUBLIC must be preceded with all the public members

For explanation: The public members in java must be preceded with the keyword public. It must be mentioned with each public member, unlike C++ where we MENTION it only once. In java, each member must have explicit declaration of specifier type.



Discussion

No Comment Found

Related InterviewSolutions