java 数组表达式_表达式的类型必须是数组类型,但它解析为“Temperature”-JAVA

大家好,

所以我做了一个温度类,它有一个构造器来调节温度。

温度是2个数字[寒冷,热度]的数组列表。

public int hotness;

public int coldness;

public int[] temperature;

public int maxTemperature = 10000;

//Constructor Temperature

public Temperature(int hotness, int coldness) {

/**

* A constructor for the Array Temperature

*/

maxTemperature = getMaxTemperature();

if(hotness <= maxTemperature && coldness <= maxTemperature)

temperature[0] = coldness;

temperature[1] = hotness;

}现在我想进入另一个课程并使用该对象温度来做一些计算。这是它的代码。

//Variabels

public int volatility;

private static Temperature temperature;

private static int intrensicExplosivity;

public static int standardVolatility(){

if(temperature[0] == 0){

int standardVolatility = 100 * intrensicExplosivity * (0.10 * temperature[1]);

}所以现在我得到的错误:表达式的类型必须是数组类型,但它解析为“温度”

任何解决方案

我对Java很陌生,所以可能只是一些synthax错误,但我无法找到它。

提前致谢。

大卫

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值