Java Keyword Import

The reserved keyword import is used at the beginning of a Java source (*.java) file to specify specific classes or entire Java packages to be referenced to later without having to include their package names in the reference. Starting with Java 5, you can import static members of a class, although not commonly used among Java programmers.

//JavaCodeDepot Sample 

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import java.util.*;


The first three import statements are all importing specific Java classes to be used later in the Java program. The next line is a wildcard import using the asterisk (*), which will import all classes within the Java package.

It is considered more efficient to import specific classes rather than using the wildcard method, although completely legal to do so.

The complete list of Java reserved keywords contains a total of 50 keywords and 3 literal words that are unable to be used as variable names.

Add a Comment

Your email address will not be published. Required fields are marked *