User input in Java versus python
<p>Again problem with understanding Java. When I asked previous question about <a href="http://stackoverflow.com/questions/10215225/hello-world-in-java-understanding-the-concept-versus-in-python">Hello world in Java versus python</a>, I received suggestion of taking the language as granted for a while till I don't get hang of it. However, I cannot take that approach and is baffled by some weird things in Java versus python.</p>

<p>Here is the program which takes input from user and convert F to degree Celsius in python.</p>

<pre><code>def main ():
 fahr = input (" Enter the temperature in F: ")
 cel = ( fahr - 32) * 5.0/9.0
 print " the temperature in C is : " , cel
</code></pre>

<p>This is pretty straightforward without any quirky things going on inside.</p>

<p>The example to do the same thing in Java:</p>

<pre><code>import java . util . Scanner ;

 public class TempConv {
 public static void main ( String [] args ) {
 Double fahr ;
 Double cel ;
 Scanner in ;

 in = new Scanner ( System . in );
 System . out . println (" Enter the temperature in F: " );
 fahr = in . nextDouble ();

 cel = ( fahr - 32) * 5.0/9.0;
 System . out . println (" The temperature in C is : " + cel );

 System . exit (0);
 }

 }
</code></pre>

<p>What I thought should happen was: Scanner was Java class/instance of class/object to take user input and with </p>

<pre><code>Scanner in
</code></pre>

<p>created a new object to take user input. It turns out to be we are just declaring in to be of Scanner type in Java (Correct me if I am wrong).</p>

<p>Now, if it was python, we would have just called the method of the newly created Scanner object that takes input from the user. OMG, what is this in Java? We create </p>

<blockquote>
  <p>new Scanner</p>
</blockquote>

<p>object  and pass <code>System.in</code> as a parameter and assign it to </p>

<blockquote>
  <p>in</p>
</blockquote>

<p>again?</p>

<p>Can somebody please explain to me in pythonic terms, What is happening here and how and why it should differ from python so much?</p>

<p>Any creative suggestions are appreciated.</p>
