static_assert(sizeof(void*) <= sizeof(jlong), "Unsupported architecture");
错误:
import java.util.Scanner;
public class OnlineShop {
public static void main (String[]args) {
final double subAmmount;
subAmmount = subAmmount + Array[i];
}
答案 0 :(得分:0)
“ subAmmount”尚未初始化/设置,因此您不能向其自身添加subAmmount,因为它不等于任何值。
答案 1 :(得分:-1)
由于subAmount
未声明为static
,因此必须在声明时进行初始化。所以你应该有这样的东西
import java.util.Scanner;
public class OnlineShop {
public static void main (String[]args) {
final double subAmmount = Array[i]; // Assuming Array[i] is defined somewhere
}
如果您想先声明然后初始化,则可以这样做:
import java.util.Scanner;
public class OnlineShop {
static final double subAmmount;
public static void main (String[]args) {
subAmmount = Array[i]; // Assuming Array[i] is defined somewhere
}
在final
关键字上仔细检查一下link