Answered You can hire a professional tutor to get the answer.
I'm having issues with the following code: /* * To change this license header, choose License Headers in Project Properties.
I'm having issues with the following code:
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package sdev425;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
/**
*
* @author B_Sny
*/
public class Sdev425 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// Read the filename from the command line argument
String filename = args[0];
BufferedReader inputStream = null;
String fileLine;
try {
inputStream = new BufferedReader(new FileReader(filename));
System.out.println("Email Addresses:");
// Read one Line using BufferedReader
while ((fileLine = inputStream.readLine()) != null) {
System.out.println(fileLine);
}
} catch (IOException io) {
System.out.println("File IO exception" + io.getMessage());
} finally {
// Need another catch for closing
// the streams
try {
if (inputStream != null) {
inputStream.close();
}
} catch (IOException io) {
System.out.println("Issue closing the Files" + io.getMessage());
}
}
}
}
When running this code, without defining the .txt file for the argument I get the following output:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
at sdev425.Sdev425.main(Sdev425.java:23)
When running this code with the .txt file defined it lists the entire contents of the .txt file instead of what the code is created to do. The output is as follows:
fred@
donna@
jessie@
tina@
BUILD SUCCESSFUL (total time: 0 seconds)
I'm so lost!!!!! please help