Access modifiers

is it compulsory to use access modifiers in front of every method or class in java?

No. No access modifier makes a class or member “package-private” so every class in the same package can access it but a class from another package can’t.

1 Like