This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
When i am executing the code below by the command
the output is Usage ShowFile File
java ShowFile TEST.TXT
output : FileNotFound
i don't understand the logic of this program, shall i create a file before executing a program or what ??
if yes then where shall i place the file, in the bin folder where jdk is installed ??
please help ??
As indicated the program should be run like java ShowFile C:/MyFolder/test.txt If you look at the code there are two Exceptions handled - one is to check whether you give the file name as a command line argument and the other to check if the given file exists. So please create the file before giving it as an argument.