有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

如何在java中为数组和getback添加值?

我如何将下面给出的numOne值添加到一个数组中,以便在需要before值时可以从该数组中获取。每次单击运算符时,我都需要在重置数字之前将值存储在数组中

public void onClickOperator(View v){
    Button op = (Button) v;
        if (stxtOutput != "") {
            if (!opt) {
                if (current_operator == "") {
                    stxtInput += op.getText();
                    num1 = "";
                    numOne = 0.0;
                    Result = pt;
                    stxtOutput = format.format(pt);
                    current_operator += op.getText().toString();
                    opt = true;
                    decimal = false;
                    update();

我试图添加,但出现了错误

ArrayList<Double> numb;
numb = new ArrayList<>();
numb.add(numOne);

如果存储的最后一个值是numb。添加(i)我需要在值i-1之前获得的值


共 (0) 个答案