Reading files in Java vs. Python
<p>I am currently learning Java for an intro CS class. I have beginner experience with Python, which I learned from the eTextbook Learn Python the Hard Way (<a href="http://learnpythonthehardway.org/book/" rel="nofollow">http://learnpythonthehardway.org/book/</a>).</p>

<p>I am learning Java by converting the Python source in the book to Java source.</p>

<p>I am stuck on opening and reading files in Java. I want to convert this Python code (exercise 15 in the book) to Java:
</p>

<pre><code>from sys import argv

script, filename = argv

txt = open(filename)

print "Here's your file %r:" % filename
print txt.read()

print "Type the filename again:"
file_again = raw_input("&gt; ")

txt_again = open(file_again)

print txt_again.read()
</code></pre>

<p>This is what I have for opening the file in Java:
</p>

<pre><code>System.out.println("Type the filename again: ");
Scanner in = new Scanner(System.in);
String file_name = in.nextLine();
try
{
    Scanner txt_again = new Scanner(new File(file_again));

}
catch ( IOException e)
{
    System.out.println("Sorry but I was unable to open your file");
    e.printStackTrace();
    System.exit(0);
}
</code></pre>

<p>How do I output the opened file (a text file)? Also, how do I add arguments (i.e. script, filename) in Java?</p>
