我正在尝试将String从一个类带到另一个类,但是出现以下错误:
java.lang.NumberFormatException:对于输入字符串:“”
“主班”是这样的:
import java.text.DecimalFormat;
public class calculadora_de_cuotas extends javax.swing.JFrame {
String divimmtt="";
public String getDivimmtt() {
return divimmtt;
}
public void setDivimmtt(String divimmtt) {
this.divimmtt = divimmtt;
}
public void calculoINTYK() {
int monto = Integer.parseInt(txtmonto.getText());
int tiempo = Integer.parseInt(txttiempo.getText());
int interes = Integer.parseInt(txtporciento.getText());
double interescalcu = 0.01 * interes;
montint = monto * interescalcu;
mitiem = montint * tiempo;
double monmitiem = monto + mitiem;
double divimmt = monmitiem / tiempo;
DecimalFormat formato2 = new DecimalFormat("#.##");
this.divimmtt = (formato2.format(divimmt));
calculado.setText(divimmtt);
}
}
这是另一堂课*
import javax.swing.JOptionPane;
public class AsignarPrestamo extends javax.swing.JFrame {
private void asd(){
try{
calculadora_de_cuotas cdc = new calculadora_de_cuotas();
cdc.calculoINTYK();
String xx = cdc.getDivimmtt();
JOptionPane.showMessageDialog(null, xx);
System.out.println(xx);
} catch(NumberFormatException mmk){
System.out.println(mmk);
}
}
}