Janki
Java progrm
1 Answer(s)      2 years and 3 months ago
Posted in : Java Beginners

Write a Java progrm that copies one text file to another, converting every lower case character to upper case equivalent. Names of surces file and destination file should be passed from command line.

View Answers

February 26, 2011 at 1:06 PM


Java Copy File

import java.io.*;
import java.util.*;
public class CopyFile{
  private static void copyfile(String srFile, String dtFile){
    try{
      File f1 = new File(srFile);
      File f2 = new File(dtFile);
      BufferedReader br=new BufferedReader(new FileReader(f1));
      BufferedWriter bw=new BufferedWriter(new FileWriter(f2,true));

     String line="";
      while ((line = br.readLine())!=null){
        bw.write(line.toUpperCase());
      }
      bw.close();
      System.out.println("File copied.");
    }

    catch(IOException e){
      System.out.println(e.getMessage());      
    }
  }
  public static void main(String[] args){
   Scanner input=new Scanner(System.in);
   System.out.print("Enter source file with path: ");
   String file1=input.next();
   System.out.print("Enter destination file with path: ");
   String file2=input.next();
   copyfile(file1,file2);
   }
}









Related Pages:
Progrm
Progrm  Write a JAVA program to add or subtract days in current date and time values using JAVA calendar class
Java progrm
Java progrm   Write a Java progrm that copies one text file to another, converting every lower case character to upper case equivalent. Names...;Java Copy File import java.io.*; import java.util.*; public class CopyFile
upload a file into database and progrm should support excel and text and csv file formats
upload a file into database and progrm should support excel and text and csv file formats  Hai all, I need a program to upload a file into database table... and the program should support .excel ,.txt ,.csv file formats. can
java with xml
java with xml  Hi i am reading xml data with sax parser in java. ok its fine. But in future xsd and xml will change. now my question is if xsd and XML will change my java progrm will not change. is it possible ? Thanks
java with xml
java with xml  Hi i am reading xml data with sax parser in java. ok its fine. But in future xsd and xml will change. now my question is if xsd and XML will change my java progrm will not change. is it possible ? Thanks
thread program for calculator implementation
thread program for calculator implementation  Hi i'm prem i need calculator progrm in java that are implemented by Thread interface.....pls strong text
Java
Java  I compiling my jdbcodbc progrm. D:\Java\jdk1.6.0\bin>javac JdbcExample.java JdbcExample.java:12: cannot find symbol symbol : method ClassforName(java.lang.String) location: class JDBCExample ClassforName
Regarding path settings in java
of setting paths in Java.I setted classpath(C:\java\j2sdk1.4.2\lib) and path(c:\java\j2sdk1.4.2\bin) in system variables. But when i compile simple java progrm.../java/learn-java-in-a-day/download-and-install-java.shtml http
jdbc
jdbc  I compiling my jdbcodbc progrm. D:\Java\jdk1.6.0\bin>javac JdbcExample.java JdbcExample.java:12: cannot find symbol symbol : method ClassforName(java.lang.String) location: class JDBCExample ClassforName
java
java  diff bt core java and java
java
java  what is java
JAVA
JAVA  how the name came for java language as "JAVA
java
java   why iterator in java if we for loop
java
java  explain technologies are used in java now days and structure java
java
java  different between java & core java
java
java  is java open source
java
java  what is java reflection
java
java   in java does not pointers concept but what is nullpointers in java?   nullpointer is a runtime Exception
java
what is the size of array in java ?  what is the size of array in java ? what is the mean of finalize in java
java
java   What is ?static? keyword
java
java  RARP implementation using java socket
java
java  sample code for RARP using java
java
java  Does java allows multiline comments
Java
Java  how to do java in command prompt
java
java  give a simple example for inheritance in java
java
java  give a simple example for inheritance in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  why to set classpath in java
java
java  Write a java code to print "ABABBABCABABBA
java
java  write a program in java to acess the email
java
java  send me java interview questions
java
java  how use java method
java
java  what are JAVA applications development tools
Java
Java   Whether Java is Programming Language or it is SOftware
java
java  is java purely object oriented language
java
java  why multiple inheritance is not possible in java
java
java  explain object oriented concept in java
java
java   difference between class and interface
java
java  create java program for delete and update the details,without using database, just a normal java program
java
java  different between java & core java print("code sample
java
java  hi im new to java plz suggest me how to master java....saifjunaid@gmail.com
java
java   How to set java Policy for applet using jdk 6
java
java  dear, i want a field for date picker using java/java script
java
java  why methods in java raise exceptions   Have a look at the following link: Java Exceptions
java
java code to search the nodes  how to write the java code to search the nodes using routers
java
java online telephone directory  i need coding for online telephone directory..by using java....pls help me
java
java  how to edit text document by using java then how to edit starting and ending of text document by using java
java
java  different between java & core java print("code sample

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.