I have the following piece of code:
public class assertUse{
public void m1(int value)
{
assert 0<=value;
System.out.println("OK");
}
public static void main(
String[] args){
assertUse aU=new assertUse();
System.out.println("assertUse.m1(1):");
aU.m1(1);
System.out.println("assertUse.m1(-1):");
aU.m1(-1);
}
}
Shouldn't it throw an erro when -1 is passed to m1(). When I compile it the program gives the following output:
assertUse.m1(1):
OK
assertUse.m1(-1):
OK
I am not sure why it is not throwing an asertioerror in case of -1. Can somebody help?