Home / CSE MCQs / Java 8 :: Discussion

Discussion :: Java 8

  1. 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?
  2. 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

    View Answer

    Workspace

    Answer : Option D

    Explanation :



Be The First To Comment