I have an array list I am trying to add values into it and I am running into exception. I have used this code many times much still can't figure out what is creating this error, below is the code for your reference.
The line where I am using add method I get into a null pointer exception, All the above values are getting printed in console)
sid = new ArrayList<String>();
Enumeration e = Global.qtutlist.keys();
int qj=0;
//iterate through Hashtable keys Enumeration
while(e.hasMoreElements())
{
System.out.println("sid is key and its value id" );
System.out.println(Integer.parseInt(e.nextElement().toString()));
try
{
sid.add(e.nextElement().toString());
System.out.println("lenght is "+ sid.size());
}
catch(Exception ex)
{
System.out.println("caught exception is"+ex.getMessage());
}
}