Answer to Question #6893 in Java | JSP | JSF for Nivas

Question #6893
Please check the below Java code and highlight things that which is wrong in the code and could be improved. Please use Java-style comments (//).

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Collections;
import java.util.Date;
import java.util.Vector;

import org.apache.log4j.helpers.FileWatchdog;


/**
*
* Simple class that reads in a file - sorts its lines in natural order,
* writes it back out to the given filename and adds a timestamp of when it was sorted
*
* Program will be called with:
*
* java TestClass <input_filename> <output_filename>
*
*/
public class TestClass {


public static void main(String [] args) throws RuntimeException{
boolean OVERWRITE_FILE = true;
//get filename from args
String inputFilename = args[0];
String outputFilename = args[1];

//check usage
if(args.length != 2){
System.out.println("Incorrect
0
Expert's answer

Answer in progress...

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS