You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
435 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

public class Jb07_IfDemo
{
public static void main(String[] args)
{
// 判断结构:
// 当if else运算后由具体结果时可简化成三元运算符
int x = 1;
if (x>3)
{
System.out.println("yeah");
}
else if (x>2)
{
System.out.println("OK");
}
else
{
System.out.pintln("欧了");
}
//局部代码块可定义局部变量的生命周期。
{
int y = 3;
}
System.out.println("over"+y); //y在局部代码块里会出现错误。
}
}