java - 输出:无错误您可能分配了太多内存任何人都可以详细解释
问题描述
查看下面的源代码
class Test
{
public static void main(String[] args)
{
Double object = new Double("2.4");
int a = object.intValue();
byte b = object.byteValue();
float d = object.floatValue();
double c = object.doubleValue();
System.out.println(a + b + c + d );
}
}
输出:无错误您可能分配了太多内存
谁能详细解释
解决方案
将您的代码更改为
Double object = new Double("2.4");
int a = object.intValue();
byte b = object.byteValue();
float d = object.floatValue();
double c = object.doubleValue();
System.out.println(a);
System.out.println(a + b);
System.out.println(a + b + c);
System.out.println(a + b + c + d );
并探索
推荐阅读
- c++ - 我可以设置 OpenGL 相机看正 z 吗?
- javascript - Google Appscript 从一列转置动态数据组
- json - 发送多个参数 XMLHttpRequest 和 WCF
- r - optim 使用 Pareto 优化提供的非有限值
- javascript - 如何为下拉列表ajax添加箭头键控件
- android - 允许 ssl 验证程序后的 Firebase 身份验证错误
- tensorflow - 在这种情况下,如何使用数据加载器进行模型训练?
- java - 导入 maven 项目时,以小型 - sts 显示项目名称
- c - 为什么多个调用同一函数的 pthread_create() 最终会出现分段错误?
- android - 在 Android Studio 中配置图片资源,next 按钮仅振动模态