728x90 AdSpace

Trending

Display content of file in java easily

import java.io.*;
import java.util.*;
class DisplayFile{
public static void main(String arg[]){
try{
Scanner s=new Scanner(System.in);
System.out.println("Enter Original File Name :-");
String filename=s.next();
//================================opening the file to read the content
FileReader fr=new FileReader(filename);
BufferedReader br=new BufferedReader(fr);
System.out.println("Enter Filename to which content should be displayed:");
String filecontent;
filecontent=br.readLine();
while(filecontent!=null)
{
System.out.println(filecontent);
filecontent=br.readLine();
}
br.close();
System.out.println("file content displayed Sucessfully");
}catch(Exception e){
System.out.println("fileNotFound");
}
}
}
Imperative programming is a programming paradigm that describes computation in terms of statements that change a program state
A declarative programming is a higher level programming language which allows you to express what you want without specifying how to get it.
Imperative language make use of data structures such as arrays, records etc. Array elements and record fields are changed by successive destructive assignments.
In declarative languages, where there is no destructive assignment, explicit representations for data structures must be used. The most fundamental data structure used by declarative programming languages is the list.
In most imperative languages sub-programs cannot be passed as actual parameters to other sub-programs, or be passed back as results (there are exceptions).
In declarative languages, relationships may construct new relationships and pass then on to other relationships as arguments. Thus declarative languages allow definitions or expressions to be treated in the same manner as more standard parameter data items.



comment box is waiting for you..........!
Display content of file in java easily Reviewed by B AProgrammer on 10:48 Rating: 5 import java.io.*; import java.util.*; class DisplayFile{ public static void main(String arg[]){ ...

No comments: