Java 多个else用法

/**
 * Created by xabcd on 2019/2/12.
 */
public class Testjava_ifn
{public static void main(String[] args)
{
    int x = 1;
    if (x ==1)
        System.out.println("x ==1");
    else if(x ==2)
        System.out.println("x ==2");
    else if (x ==3)
        System.out.println("x ==3");
    else
        System.out.println("x>3");
}
}

留下评论

您的邮箱地址不会被公开。 必填项已用 * 标注