简体   繁体   中英

How to use jscience constants in java?

I need some of the scientific constants for my project and i found jscience lib. but i can't find a way to use jscience constants. I see the TUTORIAL but there was nothing to explain how to use constants.

So how can i use constants in jscience?
And is any more tutorial or samples of use this lib?

You import them :

 import static org.jscience.physics.units.SI.*; // Static import.
 ...
 Unit<Pressure> HECTO_PASCAL = HECTO(PASCAL);
 Unit<Length> KILO_METER = KILO(METER);

Look at the javadoc at http://jscience.org/api/ , you will find many examples.

EDIT:

Actually it's

 import static javax.measure.unit.SI.*; // Static import.

The example in the javadoc is wrong about the package name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM