简体   繁体   English

我如何与 '>' 进行比较

[英]How can I compare with '>'

I am working on a program using package for the FTC robotics tournament.我正在开发一个使用 FTC 机器人锦标赛包的程序。 My issue is with我的问题是

import com.qualcomm.robotcore.util.ElapsedTime;

The variable runtime does not compare with an int as it is a Type ElapsedTime .变量runtime不与 int 进行比较,因为它是 Type ElapsedTime I have tried just about every thing I could find and it either results in a compile or runtime error.我已经尝试了几乎所有我能找到的东西,它要么导致编译错误,要么导致运行时错误。 How can I do: if (runtime > 10) { ?我该怎么做: if (runtime > 10) {

The documentation on this class shows quite a number of fields.这个类的文档显示了相当多的字段。

https://ftctechnh.github.io/ftc_app/doc/javadoc/com/qualcomm/robotcore/util/ElapsedTime.html https://ftctechnh.github.io/ftc_app/doc/javadoc/com/qualcomm/robotcore/util/ElapsedTime.html

While the following code snippet should compile (and run), it may not be correct for what you are using it for.虽然以下代码片段应该可以编译(并运行),但它可能不适合您的用途。
(For instance, do you case about nanosecond precision? Or are seconds good enough?) (例如,您是否考虑纳秒精度?或者秒是否足够好?)

    if (10 < runtime.time())
    {
        System.out.println("`runtime.time()` is greater than 10");
    }

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

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