jsp问题
在netBeans上写了一个简单的网页计算器,但是javaBean里有个错误,哪位大侠帮帮改一下~~~代码如下:
package Bean;
public class SimpleCalculator{
private String first;
private String second;
private double result;
private String operator;
public void setFirst(String first){
this.first=first;
}
.........
//下面是操作
public void calculate(){
double one=Double.parseDouble(first); // 说这一行有错误:java.long.NullPointerException
double two=Double.parseDouble(second);
try{
if(operator.equals("+"))result=one+two;
if(operator.equals("-"))result=one-two;
if(operator.equals("*"))result=one*two;
if(operator.equals("/"))result=one/two;
}
catch(Exception e){}
}
}
高手帮忙