I have a set of 'instance' 'variables' and i want to assign it values inside a 'loop'. The 'loop splits' a 'string' into an 'array', does a type check and assigns its values to individual instance variables 'declared' in the class. This is how the code looks like:
/******* PROCESSING THE XFILES PARAMTER TO GET THE STRINGS ***********/
if(xfileCount>0){
// Setting variable
String[] xFileSplit;
String xfName="";
String xfValue="";
int counti=0;
// We start processing
for(String fileData:xfileArray){
// WE FURTHER BREAK X FILES
xFileSplit=fileData.split(":");
// Now lets get values
xfName=xFileSplit[0];
xfValue=xFileSplit[1];
counti++;
System.out.println(counti);
// NOW LETS CHECK TO ASSIGN
if(xfName=="indexDir"){
// Assign values
indexPath=xfValue;
}
else if(xfName=="docDir"){
// Assign values
docPath=xfValue;
}
else if(xfName=="nio"){
// Assign values
nio=Integer.parseInt(xfValue);
}
} // End of loop
} // End of count check
The problem is that in looping the string array to assign values to individual instance variables, i keep getting null for the string type and 0 for the integer type and this is because the values wasn't assigned to the public variables in the loop. Please i need a help with this, if any any body has ran into this kind of issue.