|
1
2
3
4
5
6
7
|
class VarDemo {
public static void main(String[] args) {
int x = 30;
x = x++;
System.out.println(x);
}
}
|
|
1
2
3
4
5
|
if (score >=90) {
if (score >=95) {
System.out.println("very very good");
}
}
|
|
1
2
3
|
if (score >=90)
if (score >=95)
System.out.println("very very good");
|
|
1
2
|
if (score >=95)
System.out.println("very very good");
|
|
1
|
System.out.println("very very good");
|
|
1
2
3
4
5
6
|
{
int a=1;
a=a+1;
//代码块内的运算,可以定义变量的生命周期,作用域值只在这个代码块内
System.out.println(a);
}
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
class SwitchDemo {
public static void main(String[] args) {
int x =4;
switch (x) {
default:
System.out.println("d");
// break;
case 1:
System.out.println("a");
// break;
case 2:
System.out.println("b");
break;
case 3:
System.out.println("c");
break;
}
}
}
|
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29917475/viewspace-2120495/ ,如需转载,请注明出处,否则将追究法律责任。