title: java nashorn, how to add code to a constructor
body: <p>How can i add code to a construtor of a javascript class.
  The code in Java is very simple:</p>
  
  <pre><code>public class MyObject extends SomeAbstractObject {
    public MyObject() {
       super();
       System.out.println("hello");
    }
  }
  </code></pre>
  
  <p>I know that its possible to extend java class like this (let's assume i did some bindings): </p>
  
  <pre><code>var myJSClass= Java.extend(SomeAbstractObject.static 
       {methods i want to override}
  })
  </code></pre>
  
  <p>But how can i replicate my java example in javascript and nashorn?</p>