adplus-dvertising
frame-decoration

Question

Which function among the following can’t be accessed outside the class in java in same package?

a.

public void show()

b.

void show()

c.

protected show()

d.

static void show()

Answer: (c).protected show()

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which function among the following can’t be accessed outside the class in java in same package?

Similar Questions

Discover Related MCQs

Q. If private members are to be called outside the class, which is a good alternative?

Q. A private function of a derived class can be accessed by the parent class.

Q. Which error will be produced if private members are accessed?

Q. Can main() function be made private?

Q. If a function in java is declared private then it __________________

Q. What are public member functions?

Q. Which among the following is true for public member functions?

Q. Which type of member functions get inherited in the same specifier in which the inheritance is done? (If private inheritance is used, those become private and if public used, those become public)

Q. Which syntax among the following is correct for public member functions?

Q. Which syntax is applicable to declare public member functions in C++?

Q. In java, which rule among the following is applicable?

Q. How many public members are allowed in a class?

Q. Which is not a proper way to access public members of a class?

Q. Which call is correct for public members of a nested class?

Q. Which public function call among the following is correct outside the class, if return type is void (C++)?

Q. If public members are to be restricted from getting inherited from the subclass of the class containing that function, which alternative is best?

Q. A derived class object can access the public members of the base class.

Q. If a class have a public member function and is called directly in the main function then ___________________________

Q. The function main() must always be public.

Q. All the public member functions ___________________