if else 条件分支判断

package com.hqyj.javacode.Ifelse;

public class TestIfElse {
public static void main(String[] args) {
//if判断
int soce=80;
if (soce>60)
System.out.println("A");
else
System.out.println("B");
//上面输出A
//2. if变形 if控制一条语句 当只有一句时扩号可以省略

if (soce>70) System.out.println("A");
else
System.out.println("B");
//上面输出A
}
}
posted @ 2022-03-21 20:10  java小寇  阅读(41)  评论(0)    收藏  举报