2013年11月4日星期一

Why does my eclipse of the assert statement is not running ?

Novice, recently knocked against the code book and found assert assert statement does not run , that is, does not work, the following procedure , experts advise :
import java.lang. *;
public class java03030701 {
public static void main (String [] args) {
remainder (12);
remainder (-7);
}

public static void remainder (int num) {
if (num% 3 == 0) {
System.out.println (num + " In addition to 3 , the remainder is 0 " ) ;
}
else if (num% 3 == 1) {
System.out.println (num + " In addition to 3 , the remainder is 1" ) ;
}
else {
assert num% 3 == 2: num + "% 3, the remainder non- 2" ;
System.out.println (num + " In addition to 3 , the remainder is 2" ) ;
}
}

}

the results shown in Figure

------ Solution ------- -------------------------------------
no way, to the sub- Results posted !

没有评论:

发表评论