function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PreyankaPreyanka 

Assign value to array

Hi  

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...

Thanks
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

qList.add(q);

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