BCA JAVA 2015 SLIP 11



import java.io.*;

class Reverse_File
{
      public static void main(String a[]) throws Exception
      {
            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
            System.out.println("Ente file name");
            String fname=br.readLine();
            FileInputStream fin = new FileInputStream(fname);
            BufferedInputStream bis = new BufferedInputStream(fin);
            int s = bis.available();
            System.out.println(s);
            for(int i=s-1;i>=0;i--)
            {     bis.mark(i);
                  bis.skip(i);
                  System.out.print((char)bis.read());
                  bis.reset();
            }
            fin.close();
      }
}

No comments:

Post a Comment