title: Need some help with Scala's instance variables
body: <p>Assume this Java code:</p>
  
  <pre><code>public class A {
     public A(String g) {
        x += g.length();
     }
  
     private int x = 0;
  }
  </code></pre>
  
  <p>If I create an instance of A, like this:</p>
  
  <pre><code>A a = new A("geo");
  </code></pre>
  
  <p>after this call, the value of x will be 3. What am I doing wrong in my Scala code?</p>
  
  <pre><code>class A(val g:String) {
    x += g.length
    var x:Int = 0
  }
  
  object x extends Application {
    val x = new A("geo")
    println(x.x)
  }
  </code></pre>
  
  <p>This prints 0. I assumed that when the compiler reaches the <code>var x:Int = 0</code>, the body of the main constructor has ended. Am I wrong? How else could you declare instance variables in Scala ( assuming I don't want them in my constructor ) ?</p>