public class first
{
public static void main(String args[])
{
String line,line1;
String array[]=new String[20];
BufferedWriter bw = new BufferedWriter(new FileWriter("F:\\prog1\\file1.txt",true);
StringBuffer sb = new StringBuffer();
Scanner scan=new Scanner(new File("F:\\prog\\file.txt"));
while (scan.hasNext())
{
line=scan.next();
line1=line.toLowerCase();
array=line1.trim().spilt("\\s+");
}
sb.append(array[0]).append(" ");
for(int i=1;i<array.length;i++)
{
sb.append(array[i]).append(",");
}
bw.write(sb.toString());
bw.flush();
bw.close();
}
}
when i write the above code i can insert comma between variables but i should end the line with semicoln instead i am ending with comma.