Java code written in MPL, says it's wrong?
<p>I need to write down some code, but MPL says it's wrong? Could't figure out what was wrong?</p>

<p>Write the definition of a class  Counter containing: </p>

<ul>
<li>An instance variable named  counter of type  int . </li>
<li>An instance variable named  limit of type  int . </li>
<li>A static  int variable named  nCounters which is initialized to  0 . </li>
<li>A constructor taking two  int parameters that assigns the first one to  counter and the second one to  limit . It also adds one to the static variable  nCounters . </li>
<li>A method named  increment . It does not take parameters or return a value; if the instance variable  counter is less than  limit ,  increment just adds one to the instance variable  counter .   </li>
<li>A method named  decrement that also doesn't take parameters or return a value; if  counter is greater than zero, it just subtracts one from the  counter . </li>
<li>A method named  getValue that returns the value of the instance variable  counter . </li>
<li>A static method named  getNCounters that returns the value of the static variable  nCounters . </li>
</ul>

<p>My code I wrote:</p>

<pre><code>public class Counter {

    private int counter;
    private int limit;
    private static int nCounters = 0;

    public Counter(int counter, int limit) {
        nCounters++;

    }

    public void increment() {
        if (counter &lt; limit) {
            counter++;
        }
    }

    public void decrement() {
        if (counter &gt; 0) {
            counter--;
        }
    }

    public int getValue() {
        return counter;
    }

    public static int getNCounters(){
        return nCounters;
    }
}
</code></pre>

<p>MPL says: </p>

<blockquote>
  <p>Remarks:<br>
           ⇒     Your constructor does not initialize counter properly<br>
           ⇒     Your code had an error during execution  </p>
  
  <p>Problems Detected:<br>
           ⇒     value of counter is incorrect</p>
</blockquote>
