title: How to declare class in Java Nashorn?
body: <p>I know that i can extend abstract classes and interfaces through <code>Java.extend</code>, but how can i add custom methods, constructors and fields in class? I tried to like this, but it's not works:</p>
  
  <pre><code>var MyClass = Java.extend(java.lang.Object, {
      myField1: java.lang.String,
      myField2: java.lang.Object,
      "&lt;init&gt;": function(arg1, arg2) {
          // Try to declare constructor
      },
      myMethod: function(arg1, arg2, arg3) {
          // Try to declare method
      }
  });
  </code></pre>