Modifiers

C# and Java both use modifiers to specify the accessibility and behavior of program elements. Much commonality exists between Java and C# modifiers, but many differences and inconsistencies exist as well. The differences in usage and effect are often subtle and difficult to understand and remember when coming to C# from a Java background. In this section, we contrast the Java and C# modifiers. We group these modifiers into three categories: access, inheritance, and other.

Access Modifiers

C# includes all of the access modifiers available in Java and provides additional flexibility with the introduction of two new modifiers. However, accessibility based on package membership in Java doesn’t translate to the equivalent accessibility based ...

Get C# for Java Developers now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.