am trying to read file in java but i have an issue bufferReader are stating from number 2

`public static String lineLengths()
    {
        try
        {
            String file = "C:\\\\Users\\\\isslam\\\\Documents\\\\NetBeansProjects\\\\AnimeAid\\\\tra.srt";

            BufferedReader br = null;
            try  { br = new BufferedReader(new FileReader(file)); }
            catch (FileNotFoundException e) { System.out.println(e); }

            String line;
            while((line = br.readLine()) != null)
            {
                line = line.trim();

                if (isInteger(line))
                {
                    int i = Integer.parseInt(line);
                    if (i > 0) { System.out.println(line); }
                }

            }
        }
        catch(  NumberFormatException | IOException ex) { ex.printStackTrace(); }
        return null;

    }

    public static boolean isInteger( String input )
    {
        try
        {
            Integer.parseInt(input);
            return true;
        }
        catch(NumberFormatException e ) { return false; }
    }`

i tried to and enter in the begining of the file it Works! but when the number are the first line in the file java ignore it

Your file name looks wrong - too many back-slashes. YOu only need two backslashes in your String literal to represent a single backslash in the file path

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.