Link to home
Start Free TrialLog in
Avatar of gudii9
gudii9Flag for United States of America

asked on

static imports j2SE 5.0

Hi,

What are advantages, practical uses of
static imports introduced in j2SE 5.0.


please advise
Any links resources ideas highly appreciated. Thanks in advance
ASKER CERTIFIED SOLUTION
Avatar of dpearson
dpearson

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gudii9

ASKER

Java 4:
import java.lang.* ;

double pi = Math.PI ;    // Each time I reference "PI" need to add "Math." to the front

why we need to refer Math every time in java 4? and how it got fixed in java 5. Please advise
Avatar of dpearson
dpearson

why we need to refer Math every time in java 4? and how it got fixed in java 5. Please advise

In Java 4 that's just the way you had to write code to refer to a static value.  In Java 5 they added a new import statement so you didn't have to do it the old way.

That's really all there is to it.

Doug