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?

Question:
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?

1.Declare the method with the keyword public.

2.Declare the method with the keyword private.

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

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

Posted Date:-2021-10-25 05:16:02


More MCQS Questions and answers

Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!