MCQEasy1 mark
1
Choose the correct answers to the questions from the given options. (Do not copy the questions, write only the correct answers.)
Post office is an example for __________ access specifier.
Topic: Access specifiers
Previous-year question practice database
Try it
Pick an option and check your answer. The full worked answer is below either way.
Answer
Exam answer
(a) public.
Explanation
These analogy questions test the meaning of each specifier. A post office serves anyone who walks in, so it models public — accessible from everywhere. private would be like a personal diary (accessible only within its own class), protected like a family heirloom (the class, its subclasses and package). Note that "local" is not an access specifier at all; Java has exactly four: private, default, protected, public.
In words
public.
More from Encapsulation
Which of the following is NOT an access specifier?2026The access specifier that gives least accessibility is __________.2024Assertion (A): Static method can access static and instance variables.
Reason (R): Static variables can be accessed only by static method.2024A mechanism where one class acquires the properties of another class:2023A method which is a part of a class rather than an instance of the class is termed as:2023The access modifier that gives least accessibility is:2022