- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在运行这个timer example ,我将 i
从 int 更改为 float,以测试我的机器潜力:-) :
//measuring elapsed time using System.nanoTime
long startTime = System.nanoTime();
for(long i=0; i< 9100080000; i++){
Object obj = new Object();
}
long elapsedTime = System.nanoTime() - startTime;
但是java提示说:
1 error found:
File: C:\Users\Adel\Code\Javas\MeasureTimeExampleJava.java [line: 16]
Error: integer number too large: 9100080000
它说的是“整数”,意思是长整数?但9,100,080,000不是很长吗? 2^63 是 9223372036854775808 。任何提示表示感谢!
最佳答案
这不是变量,它是一个int
- 而是您要与之比较的文字。你只需要:
i < 9100080000L
编译器不会使用“您正在对文字做什么”作为确定文字的类型过程的一部分,也不会根据值(与 C# 不同,其中 9100080000
将隐式键入为 long
,因为它对于 int
来说太大) .
An integer literal is of type long if it is suffixed with an ASCII letter L or l (ell); otherwise it is of type int (§4.2.1).
...
The largest decimal literal of type int is 2147483648 (231).
All decimal literals from 0 to 2147483647 may appear anywhere an int literal may appear.
It is a compile-time error if a decimal literal of type int is larger than 2147483648 (231), or if the decimal literal 2147483648 appears anywhere other than as the operand of the unary minus operator (§15.15.4).
请注意,虽然 L
和 l
都可以工作,但为了清晰起见,我始终建议使用 L
- 否则它看起来会很糟糕就像 1
取决于您的字体。
关于java - 为什么 Java 将我的 long 变量称为 int?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16313238/
有谁知道如何实现称为 PRUNING 的图像处理技术?任何想法,例子等?我正在使用 OpenCV 和 C#,如果有人可以提供帮助,我将不胜感激。 最佳答案 我假设您希望从图像中移除不需要的杂散和伪影。
假设我已经构建了一个可调用对象数组 callables = [] callables << block1 callables << block2 callables << block3 callabl
这个问题在这里已经有了答案: std::shared_ptr of this (2 个答案) 关闭 8 年前。 我正在学习 C++11 特性,特别是 shared_ptr,我在引用 this 并将其
我主要是一个oracle新手,所以如果这是一个愚蠢的问题,请原谅我...... 我已经阅读了很多关于 authID 的文章,我的理解是 AUTHID 子句指示 Oracle 是否以调用者的权限 (CU
我使用的是 Python 2.7。 按照惯例,__iter__、__init__、__str__ 等内置方法使用双下划线来标识它们。为什么 next() 函数没有这个? 它与这里的其他内置函数一起
这是疏忽吗?还是跟JVM有关? 最佳答案 Java 确实有指针——不能在指针上执行指针运算。 来自可敬的JLS : There are two kinds of types in the Java p
我越来越多地发现宣传“原生”桌面应用程序的服务,但在下载或研究后发现它们是在 Electron 或类似的 Web View 框架中构建的 Web View 。他们误解了“本地人”还是我? 另外,我可以
我尝试在 Wordpress 中使用,但它在控制台中显示 jstree 不是函数在 header PHP 文件中: /dist/libs/jquery.js"> /dist/themes/defaul
我想让 scons 调用带有目录列表的 nosetests。执行此操作的最佳方法是什么? 最佳答案 如果您需要分析外部应用程序的返回码(例如,如果您调用测试),您需要使用 Command() + py
这是一些尝试使用 OOB(紧急)数据的基本代码。我的问题是,如果客户端使用 C 或 Java,则服务器部分的行为不同。请注意,您可能认为这两个客户端都有些棘手,但如果我使用 C 服务器(以更好地控制
虚拟文件系统 (VFS) 或虚拟文件系统交换机是更具体文件系统之上的抽象层。 VFS的目的是允许客户端应用程序以统一的方式访问不同类型的具体文件系统。 如果我们看到 VFS 的实际工作,这个定义似乎是
"Effective Go"状态: By convention, one-method interfaces are named by the method name plus an -er suff
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题吗? 更新问题,以便 editing this post 提供事实和引用来回答它. 关闭 3 个月前。 社区审核了是否
在深入研究 Scala 时,我遇到了 这个词。类型类 . 它一直令人困惑,因为一个类是一个类型,而一个类型可以 在 Scala 中是一个类,“类型”和“类”本身就是抽象术语。 在阅读了一些示例后,我感
我正在尝试编写一个简单地杀死我的程序的函数。它被称为退出聊天。但是,当我调用函数 messenger:quitChat() 时,出现此错误。 ** exception error: bad argum
我正在尝试编写一个简单地杀死我的程序的函数。它被称为退出聊天。但是,当我调用函数 messenger:quitChat() 时,出现此错误。 ** exception error: bad argum
如果您向 DB2/zOS 引擎 DBA 询问有关 DB2 行为的问题,DBA 会将 DB2 引擎称为“他”,就像水手使用“她”来指代他的船一样。 例如:“一旦您填充了可用空间,DB2 仍希望在表空间中
案例:我有 2 个具有以下 OneToMany 关系的表:TagAbstract 1..* TagConf,其中: tag_abstract_ID 是一个字段,用于标识许多 TagConf 记录,这些
我有一个表格,我想让第一行“自动固定”(这意味着当向下滚动时它固定在顶部,而如果不向下滚动,它就不固定)。这是代码:``` table { background: yellow; } td
其他动词对我来说都有意义,但我对“发布”作为动词没有太多上下文。它是像在邮局发帖(这有一定道理,虽然看起来有点牵强)还是像在公告板上发帖(对我来说意义不大)?有谁知道是谁决定了“POST”以及为什么选
我是一名优秀的程序员,十分优秀!