import java.io.*; public class ReadFile{ public static void main(String[] args) throws IOException{ File f; f=new File("myfile.txt"); if(!f.exists() && f.length()<0) System.out.println("The specified file is either not exist or doesn't contain data"); else{ FileInputStream finp=new FileInputStream(f); byte b; do{ b=(byte)finp.read(); System.out.print((char)b); } while(b!=-1); finp.close(); } } }