+ Start a Discussion

Assign value to array


I am facing issue while try to assign a value in an array that was declared in WSDL2Apex class. The array was declare like below in WSDL2Apex class
public testtempuriOrg.question[] question;

where question is another class and have some string variable declared. But when i try to assign the question value in testtempuriOrg.question[] from another class I get the error message "System.NullPointerException: Attempt to de-reference a null object"

Please help want need to do...

Vivek DVivek D
Try this 
// First you have to populate question 

YourOtherClass.Queston q = new YourOtherClass.Question();

// Create Array of Question
List<YourOtherClass.Queston> qList = new List<YourOtherClass.Question>();

// Add Item into list


// Assign it to your variable
// I guess testtempuriOrg and YourOtherClass might be same
testtempuriOrg.Question[] question = new List<testtempuriOrg.Question>();
question  = qList;