diff --git a/day03/src/com/inmind/if01/Demo01.java b/day03/src/com/inmind/if01/Demo01.java new file mode 100644 index 0000000..6d17739 --- /dev/null +++ b/day03/src/com/inmind/if01/Demo01.java @@ -0,0 +1,35 @@ +package com.inmind.if01; +/* +if格式一: + +if(判断条件){ + 语句; +} + +执行顺序:先执行判断条件,判断条件必须是布尔型的结果, + 如果为true,就执行大括号内部的语句,false就直接跳过大括号中的内容 +*/ +public class Demo01 { + public static void main(String[] args) { + //定义整数变量 + int i = 10; + if (i != 10) { + System.out.println("i等于10"); + } + + System.out.println("程序结束"); + System.out.println("-----------------"); + //判断2个值谁大 + int a = 10; + int b = 20; + if (a > b) { + System.out.println("a的值大,值为:"+a); + } + + if (a < b) { + System.out.println("b的值大,值为:"+b); + } + + + } +}