Keywords

C# has more keywords than Java. When both languages define the same keyword, they typically have the same function, although some equivalent features are available through different keywords. Each keyword will be discussed in detail in the appropriate section of this chapter, but we’ll begin by presenting a high-level comparison of the keywords available in both languages.

Package and Namespace Keywords

Although Java packages and C# namespaces are significantly different in their implementation and capabilities, both languages provide keywords for their use and declaration. Table 4-1 contrasts these keywords.

Table 4-1. Comparison of Package and Namespace Keywords

Java

C#

Comments

import

using

Makes the elements of a package/namespace accessible ...

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.