You need to sign in to do that
Don't have an account?
sreedharp286
How to solve System.NullPointerException: Attempt to de-reference a null object ?
hi
i am trying to send below code as package
public class calculator1{
public integer num1{get;set;}
public integer num2{get;set;}
public integer num3{get;set;}
public void add(){
num3=num1+num2;
//EmailConformation1 E=new EmailConformation1();
//E.sendMail();
}
}
but getting error
Class.calculator1.add: line 10, column 1 Class.MyTestClass34.test11: line 13, column 1
Class.calculator1.add: line 10, column 1 Class.MyTestClass34.test11: line 13, column 1
please help me quickly
Looks like to me that this error occurs because you are trying to access a non-set variables, so their values are null.
You can do this :
and the same for the other variables.
Hi,
Please try the following code.
public class calculator1{
public integer num1{get;set;}
public integer num2{get;set;}
public integer num3{get;set;}
public calculator1(){
num1=0;
num2 = 0;
num3=0;
}
public void add(){
num3=num1+num2;
//EmailConformation1 E=new EmailConformation1();
//E.sendMail();
}
}
Thanks,
Soni