Anonymous ID: 16a4c6 Jan. 18, 2023, 6:26 a.m. No.18167589   🗄️.is 🔗kun   >>7593

import java.util.Scanner;

 

public class BrowseScrip

 

{

 

public static void main(String[] args)

 

{

 

Scanner input = new Scanner(System.in);

 

System.out.println("Please enter a filename to browse:");

 

String filename = input.nextLine();

 

System.out.println("");

 

System.out.println("Opening the file:");

 

File file = new File(filename);

 

try

 

{

 

System.out.println("Opening the file:");

 

FileInputStream in = file.openInputStream();

 

System.out.println("Reading the file:");

 

BufferedReader in2 = new BufferedReader(new InputStreamReader(in));

 

String line;

 

while ((line = in2.readLine()) != null)

 

{

 

System.out.println(line);

 

}

 

in2.close();

 

file.close();

 

}

 

catch (IOException e)

 

{

 

e.printStackTrace();

 

}

 

}