what is difference between import and static import in java

Опубликовано: 17 Апрель 2026
на канале: Java code&Decode
1,081
16

what is difference between import and static import in java?
---------------------------------------------------------
Useing import, we are able to access classes and interfaces which are present in any package. But using static import, we can access all the static members (variables and methods) of a class directly without explicitly calling class name.
ex:
import java.util.*;
Sytem.out.println("welcome");
static import
import static java.lang.System.*;
out.println('welcome");