title: Assert behaviour in java?
body: <p>I am getting compilation error in Line 3, Is it any special case for asserts in java ? i am not sure why it's expecting some return type from methodB() , can somebody help me here ? Thanks</p>
  
  <pre><code>public class AssertTest {
      public void methodA(int i) {
          assert i &gt;= 0 : methodB();
          System.out.println(i);
      }
  
      public void methodB() {
          System.out.println("The value must not be negative");
      }
  
      public static void main(String args[]) {
          AssertTest test = new AssertTest();
          test.methodA(-10);
      }
  }
  </code></pre>