---
title: "What are different types of access modifiers"  
description: "What are different types of access modifiers"  
author: "Pushpendra Singh"  
published: 2010-10-25  
updated: 2020-09-21  
canonical: https://www.mindstick.com/interview/168/what-are-different-types-of-access-modifiers  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# What are different types of access modifiers

Public: Any thing declared as public can be accessed from anywhere.\
\
Private: Any thing declared as private can’t be seen outside of its class. \
\
Protected: Any thing declared as protected can be accessed by classes in the same package and subclasses in the other packages. \
\
Default modifier : Can be accessed only to classes in the same package.

## Answers

### Answer by Pushpendra Singh

Public: Any thing declared as public can be accessed from anywhere.\
\
Private: Any thing declared as private can’t be seen outside of its class. \
\
Protected: Any thing declared as protected can be accessed by classes in the same package and subclasses in the other packages. \
\
Default modifier : Can be accessed only to classes in the same package.


---

Original Source: https://www.mindstick.com/interview/168/what-are-different-types-of-access-modifiers

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
