/** * Created by xabcd on 2019/2/12. */ public class TestJava3_19 {public static void main(String args[]) { int a =555; if ((a<0)||(a>100)); System.out.println("输入的数据有误!"); if((a<60)&&(a>49)); System.out.println("准备补考吧!"); } } 结果 输入的数据有误! 准备补考吧!。
/** * Created by xabcd on 2019/2/12. */ public class h3_19_2 {public static void main(String args[]) { int a = 105; if ((a<0)|(a>100)) System.out.println("输入的数据有误!"); if((a<60)&&(a>49)) System.out.println("准备补考吧!"); } } 解决: if后面不能加分号