Using Static Imports

Using Static Imports

This feature is new in the JDK 1.5 and is intended to reduce the Java app verbosity. Static imports allow you to put into scope a set of methods and fields. Using static imports, allows you to omit qualifying class names. Here’s an example:

import static java.lang.System.out;import static java.lang.Math.*;public class StaticImport{	public static void main(String[]arr)	{		out.println("This Static Import");		out.println(ceil(10.5));}}

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist