StringBuffer problem
Hi ,
I am trying to put the different string arrays into a string buffer. Here is my code
publicclass StringBufferTest{
/**
* @param args
*/
publicstaticvoid main(String[] args){
// TODO Auto-generated method stub
String[] ruleNames ={"testrule","testrule1"};
String[] textBox1 ={"purchaseprice","debit","income","purchaseprice"};
String[] textBox2 ={"income","5000","5000","income"};
String[] textBox3 ={"","and","",""};
StringBuffer sb =new StringBuffer();
for(int i =0;i<ruleNames.length;i++)
{
for(int j =0;j<textBox1.length;j++)
{
if(i ==1)
{
sb.append(ruleNames[i]+"\t"+textBox1[j]+"\t"+textBox2[j]+"\t"+textBox3[j]+"\n");
}
}
}
System.out.print(sb.toString());
}
}
Here is the output i am getting
testrule1purchasepriceincome
testrule1debit5000and
testrule1income5000
testrule1purchasepriceincome
But actually i am lookinf for the following output
testrulepurchasepriceincome
testrule debit5000and
testrule1income5000
testrule1purchasepriceincome
where i am doing the mistake.
regards,
Krishna>

