Examveda
Examveda

A method within a class is only accessible by classes that are defined within the same package as the class of the method. Which one of the following is used to enforce such restriction?

A. Declare the method with the keyword public.

B. Declare the method with the keyword private.

C. Declare the method with the keyword protected.

D. Do not declare the method with any accessibility modifiers.

E. Declare the method with the keyword public and private.

Answer: Option D


This Question Belongs to Java Program >> Declaration And Access Control

Join The Discussion

Comments ( 2 )

  1. Vishal Jadhav
    Vishal Jadhav :
    7 years ago

    but even if we do not specify any acc.. modifier the default modifier of Class is Private so how option D is correct??...?...

  2. Hawry Jamil
    Hawry Jamil :
    8 years ago

    52.Which of the following events will cause a thread to die?

Related Questions on Declaration and Access Control