简体   繁体   English

如何在Java中使用Jscience常量?

[英]How to use jscience constants in java?

I need some of the scientific constants for my project and i found jscience lib. 我的项目需要一些科学常数,因此我找到了jscience lib。 but i can't find a way to use jscience constants. 但是我找不到使用jscience常量的方法。 I see the TUTORIAL but there was nothing to explain how to use constants. 我看到了TUTORIAL,但是没有什么可以解释如何使用常量的。

So how can i use constants in jscience? 那么我如何在jscience中使用常量呢?
And is any more tutorial or samples of use this lib? 还有使用该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. 查看http://jscience.org/api/上的javadoc,您会发现许多示例。

EDIT: 编辑:

Actually it's 其实是

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

The example in the javadoc is wrong about the package name. javadoc中的示例关于程序包名称是错误的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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