Design a site like this with
Get started

Class is inaccessible due to its protection level


As it already states that class is inaccessible due to its protection level, it means that the protection level of the constructor or class is not public due to which it cannot be accessed by any other class. Therefore, you need to make it public so it can be accessed by other classes.

Sometimes the class is public but the constructor is not due to which it is still inaccessible. So, ensure that both are public so your issue may get resolved.


Make the problematic class public e.g.

public class Teacher

instead of

class Teacher

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Create a free website or blog at

Up ↑

%d bloggers like this: