title: Extends class with two parameters of super class in Java
body: <p>I am trying to write an abstract class that extends another abstract class. The super class is <code>Expression</code>:</p>
  
  <pre><code>public abstract class Expression {
      String expression;
  
      /*Empty Constructor for Expression object */
      public Expression(){
      }
  
      /*Constructor for Expression object with String expression*/
      public Expression(String expression){
          this.expression = new String(expression);
      }
  </code></pre>
  
  <p>and the extends class is <code>CompoundExpression</code> that has two variables from type <code>Expression</code> in it:</p>
  
  <pre><code>public abstract class CompoundExpression extends Expression {
      Expression firstOperand, secondOperand;
  
      public CompoundExpression(Expression first, Expression second){
          String strFirst = first.expression;
          String strSecond = second.expression;
  
          this.firstOperand = super(strFirst);
          this.secondOperand = super(strSecond);
      }
  }
  </code></pre>
  
  <p>I figure I am doing it the wrong way cause it isn't working... Can someone help me understand why? And how I can do it the right way?</p>
  
  <p>I thought maybe to write it this way:</p>
  
  <pre><code>public abstract class CompoundExpression extends Expression {
  
      Expression firstOperand, secondOperand;
  
      public CompoundExpression(Expression first, Expression second){
  
          this.firstOperand.expression = first.expression;
          this.secondOperand.expression = second.expression;
      }
  }
  </code></pre>
  
  <p>What do you think?</p>