io

io

write a program in java to accept a filename from user and print its content on the monitor

View Answers

December 23, 2010 at 1:16 PM

Hello Friend,

Try the following code:

import java.io.*;
import java.util.*;
class DisplayContentOfFile
{
    public static void main(String[] args) throws Exception
    {
        Scanner input=new Scanner(System.in);
        System.out.println("Enter file: ");
        String str=input.nextLine();
        File file=new File(str);
        FileReader fr=new FileReader(file);
        BufferedReader br=new BufferedReader(fr);
        String line="";
        while((line=br.readLine())!=null){
            System.out.println(line);
        }
    }
}

Thanks









Related Tutorials/Questions & Answers:
Version of commons-io>commons-io dependency
List of Version of commons-io>commons-io dependency
Version of excalibur-io>excalibur-io dependency
List of Version of excalibur-io>excalibur-io dependency
Advertisements
Artifacts of io
List of Artifacts of io maven depenency
commons-io
commons-io  Hi, what is commons-io latest dependency? Thanks   Hi, This is the latest version as on today: <dependency> <.../Dependency: commons-io | commons-io Thanks
java io - Java Beginners
Java IO Streams  What is the Java IO Stream
IO concept
IO concept  Write a java program that moves the contents of the one file to another and deletes the old file.   Hi Friend, Try the following code: import java.io.*; class MoveFile{ public static void main(String
io packages - Java Beginners
io packages  How can I add two integers in java using io pacages
io
io
IO in java
IO in java  Your search mechanism will take as input a multi-word query and will return a list of documents where the given words appear. 1. Your score for this portion of the assignment will be based on the intelligence of your
ModuleNotFoundError: No module named 'io'
ModuleNotFoundError: No module named 'io'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'io' How to remove the ModuleNotFoundError: No module named 'io' error
ModuleNotFoundError: No module named 'IO'
ModuleNotFoundError: No module named 'IO'  Hi, I am trying to import IO package of Python with following code: from IO import StringIO But program throws the error: ModuleNotFoundError: No module named 'IO'. How to resolve
Version of io>ddf dependency
java IO programing
java IO programing  how Java source file is used as input the program will echo lines
Artifacts of commons-io
List of Artifacts of commons-io maven depenency
Artifacts of excalibur-io
List of Artifacts of excalibur-io maven depenency
java binary file io example
java binary file io example  java binary file io example
Maven Repository/Dependency: excalibur-io | excalibur-io
Maven Repository/Dependency of Group ID excalibur-io and Artifact ID excalibur-io. Latest version of excalibur-io:excalibur-io dependencies. # Version Release Date 1 1.1
Maven Dependency commons-io >> 1.0
You should include the dependency code given in this page to add Maven Dependency of commons-io >> commons-io version1.0 in your project
Maven Dependency commons-io >> 1.3
You should include the dependency code given in this page to add Maven Dependency of commons-io >> commons-io version1.3 in your project
Maven Dependency commons-io >> 0.1
You should include the dependency code given in this page to add Maven Dependency of commons-io >> commons-io version0.1 in your project
Maven Dependency commons-io >> 1.1
You should include the dependency code given in this page to add Maven Dependency of commons-io >> commons-io version1.1 in your project
Maven Dependency commons-io >> 1.3.1
You should include the dependency code given in this page to add Maven Dependency of commons-io >> commons-io version1.3.1 in your project
Maven Dependency commons-io >> 1.2
You should include the dependency code given in this page to add Maven Dependency of commons-io >> commons-io version1.2 in your project
Maven Dependency commons-io >> 20030203.000550
You should include the dependency code given in this page to add Maven Dependency of commons-io >> commons-io version20030203.000550 in your project
Maven Dependency excalibur-io >> 1.1
You should include the dependency code given in this page to add Maven Dependency of excalibur-io >> excalibur-io version1.1 in your project
Version of drools>drools-io dependency
List of Version of drools>drools-io dependency
Version of excalibur>excalibur-io dependency
List of Version of excalibur>excalibur-io dependency
Version of com.cedarsoftware>groovy-io dependency
List of Version of com.cedarsoftware>groovy-io dependency
Version of com.cedarsoftware>json-io dependency
List of Version of com.cedarsoftware>json-io dependency
Version of com.indix>rocksdb-io dependency
List of Version of com.indix>rocksdb-io dependency
Version of com.jenjinstudios>jenjin-io dependency
List of Version of com.jenjinstudios>jenjin-io dependency
Version of com.sandinh>spray-io dependency
List of Version of com.sandinh>spray-io dependency
ModuleNotFoundError: No module named 'adafruit-io'
ModuleNotFoundError: No module named 'adafruit-io'  Hi, My Python... 'adafruit-io' How to remove the ModuleNotFoundError: No module named 'adafruit-io' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'aqua-io'
ModuleNotFoundError: No module named 'aqua-io'  Hi, My Python...-io' How to remove the ModuleNotFoundError: No module named 'aqua-io... to install padas library. You can install aqua-io python with following command
ModuleNotFoundError: No module named 'aqua-io'
ModuleNotFoundError: No module named 'aqua-io'  Hi, My Python...-io' How to remove the ModuleNotFoundError: No module named 'aqua-io... to install padas library. You can install aqua-io python with following command
ModuleNotFoundError: No module named 'aqua-io'
ModuleNotFoundError: No module named 'aqua-io'  Hi, My Python...-io' How to remove the ModuleNotFoundError: No module named 'aqua-io... to install padas library. You can install aqua-io python with following command
ModuleNotFoundError: No module named 'CHIP-IO'
ModuleNotFoundError: No module named 'CHIP-IO'  Hi, My Python...-IO' How to remove the ModuleNotFoundError: No module named 'CHIP-IO... to install padas library. You can install CHIP-IO python with following command
ModuleNotFoundError: No module named 'cine_io'
ModuleNotFoundError: No module named 'cine_io'  Hi, My Python..._io' How to remove the ModuleNotFoundError: No module named 'cine_io... to install padas library. You can install cine_io python with following command
ModuleNotFoundError: No module named 'constructor-io'
ModuleNotFoundError: No module named 'constructor-io'  Hi, My... named 'constructor-io' How to remove the ModuleNotFoundError: No module named 'constructor-io' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'content-io'
ModuleNotFoundError: No module named 'content-io'  Hi, My Python... 'content-io' How to remove the ModuleNotFoundError: No module named 'content-io' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'content-io'
ModuleNotFoundError: No module named 'content-io'  Hi, My Python... 'content-io' How to remove the ModuleNotFoundError: No module named 'content-io' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'emitter-io'
ModuleNotFoundError: No module named 'emitter-io'  Hi, My Python... 'emitter-io' How to remove the ModuleNotFoundError: No module named 'emitter-io' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'event-io'
ModuleNotFoundError: No module named 'event-io'  Hi, My Python... 'event-io' How to remove the ModuleNotFoundError: No module named 'event-io... to install padas library. You can install event-io python with following
ModuleNotFoundError: No module named 'event-io'
ModuleNotFoundError: No module named 'event-io'  Hi, My Python... 'event-io' How to remove the ModuleNotFoundError: No module named 'event-io... to install padas library. You can install event-io python with following
ModuleNotFoundError: No module named 'event-io'
ModuleNotFoundError: No module named 'event-io'  Hi, My Python... 'event-io' How to remove the ModuleNotFoundError: No module named 'event-io... to install padas library. You can install event-io python with following
ModuleNotFoundError: No module named 'forecast_io'
ModuleNotFoundError: No module named 'forecast_io'  Hi, My Python... 'forecast_io' How to remove the ModuleNotFoundError: No module named 'forecast_io' error? Thanks   Hi, In your python environment
ModuleNotFoundError: No module named 'htk_io'
ModuleNotFoundError: No module named 'htk_io'  Hi, My Python..._io' How to remove the ModuleNotFoundError: No module named 'htk_io'... to install padas library. You can install htk_io python with following command
ModuleNotFoundError: No module named 'io-uring'
ModuleNotFoundError: No module named 'io-uring'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'io-uring' How to remove the ModuleNotFoundError: No module named 'io-uring
ModuleNotFoundError: No module named 'itk-io'
ModuleNotFoundError: No module named 'itk-io'  Hi, My Python...-io' How to remove the ModuleNotFoundError: No module named 'itk-io'... to install padas library. You can install itk-io python with following command

Ads