source file name:   TabsDemo.java

import java.io.*;

public class TabsDemo

{

public static void main(String[]args)

{

File infile=new File(args[0]);

File outfile=new File(args[1]);

FileReader ins=null;

FileWriter fos=null;

int cnt=0;

try{

ins=new FileReader(infile);

fos=new FileWriter(outfile);

int ch;

 while((ch=ins.read())!=-1)

 {

 if(ch=='\t')

 {

 ch=' ';

 cnt++;

 }

fos.write(ch);

}

ins.close();

fos.close();

 }catch(IOException e){

System.out.println(e);

 }

System.out.println("tabs="+cnt);

File inf=new File(args[1]);

try

{

ins=new FileReader(inf);

int ch;

while((ch=ins.read())!=-1)

{

System.out.print((char)ch);

}

ins.close();

fos.close();

 }catch(IOException e){

System.out.println(e);

  }

 }

}


input file contents: introduction.txt

My introduction

Mr. Suresh Nalawade

Lecturer and HOD of Computer Science

DBJ College, Chiplun Dist: Ratnagiri

State: Maharashtra

Recently I created website which contains

 C, C++ and Java programs

https://sjnprogramming.blogspot.com

Share some comments on this website and

circulate among students and

 educational institutions.

output file contents: intro.txt

D:\JavaPrograms\IOFilePrograms>javac TabsDemo.java

D:\JavaPrograms\IOFilePrograms>java TabsDemo introduction.txt intro.txt

tabs=4

My introduction

Mr. Suresh  Nalawade

Lecturer and HOD of Computer Science

DBJ  College, Chiplun Dist: Ratnagiri

State: Maharashtra

Recently I created website which contains

 C,  C++ and Java programs

https://sjnprogramming.blogspot.com

Share some comments on this  website and

circulate among students and

 educational institutions.

D:\JavaPrograms\IOFilePrograms>