I\'m preparing for a basic certification in Java.
I\'m a little confused by the answer to a question that I have got right(!):-
Given:
publ
This
import java.lang.Math.*;
imports all (accessible) types declared within Math
.
This
import java.lang.Math;
is redundant because Math
is part of java.lang
which is imported by default.
Both will require that you use
Math.PI
to access the field.
This
import static java.lang.Math.PI;
imports the static
member Math.PI
so that you can use its simple name in your source code.