Reputation: 17208
Can in java declare?
(1) import static com.example.core.MyClass;
where:
public MyClass{
public static double divide(){
.....
}
public static double add(){
.....
}
}
and in the class where use static import to use freely: devide and add methods without the prefix - name of the class. From what I read we can do:
import static com.example.core.MyClass.divide;
import static com.example.core.MyClass.add;
But Can we do it in one statement as I mentioned in (1)
Upvotes: 0
Views: 1047
Reputation: 327
You can use import static com.example.core.MyClass.*;
MyClass.*
will load all the properties inside the MyClass you won't need to access properties as MyClass.divide....
Upvotes: 1