Skip to content
This repository was archived by the owner on Nov 6, 2026. It is now read-only.
This repository was archived by the owner on Nov 6, 2026. It is now read-only.

File  #207

Open
Open

Description

@sowtheesh61-tech
No description provided.

Activity

  1. changed the title [-]import java.io.*; public class ReadFileExample { public static void main(String[] args) { String fileName = "example.txt"; try { BufferedReader reader = new BufferedReader(new FileReader(fileName)); String line; System.out.println("Contents of the file:\n"); while ((line = reader.readLine()) != null) { System.out.println(line); } reader.close(); } catch (FileNotFoundException e) { System.out.println("File not found: " + fileName); } catch (IOException e) { System.out.println("Error reading file: " + e.getMessage()); } } }[/-] [+]File [/+] on Nov 1, 2025
  2. sowtheesh61-tech commented on Nov 1, 2025

    @sowtheesh61-tech
    Author

    import java.io.*;

    public class ReadFileExample {
    public static void main(String[] args) {
    String fileName = "example.txt";
    try {
    BufferedReader reader = new BufferedReader(new FileReader(fileName));

    String line;
    System.out.println("Contents of the file:\n");
    while ((line = reader.readLine()) != null) {
    System.out.println(line);
    }

        reader.close();  
    
    } catch (FileNotFoundException e) {  
        System.out.println("File not found: " + fileName);  
    } catch (IOException e) {  
        System.out.println("Error reading file: " + e.getMessage());  
    }  
    

    }

    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions