Beginning Programming with Java For Dummies
Book image
Explore Book Buy On Amazon
With the release of Java 9, the language has ten new words called restricted keywords. A restricted keyword has a specific meaning in the language, but only if you use that word in a specific way. For example, if you write

requires other.stuff;

you tell Java that your program won't run unless it has access to some other code (the code contained in other.stuff). But if you write

int requires = 10;

then requires is an ordinary int variable.

The following table lists Java's restricted keywords.

Restricted Keyword What It Does
exports Indicates that the code in a particular package is available for use by code in other modules.
module A bunch of packages.
open Indicates that all the packages in a module are, in a certain way, available for use by code in other modules.
opens Gets access to all the code in another module. This access uses Java reflection (which tends to be messy).
provides Indicates that a module makes a service available.
requires Indicates that the program won't run unless it has access to the some other code.
to Names the code that has permission to use a particular piece of code.
transitive When my code requires use of the A code, and the Z code requires use of my code, the word transitive means that Z code automatically requires A code.
uses Indicates that a module uses a service.
with Specifies a particular way of using a service.

About This Article

This article is from the book:

About the book author:

Dr. Barry Burd holds an M.S. in Computer Science from Rutgers University and a Ph.D. in Mathematics from the University of Illinois. Barry is also the author of Beginning Programming with Java For Dummies, Java for Android For Dummies, and Flutter For Dummies.

This article can be found in the category: