| |
2.2.6.preincrement or pre-decrement, post-increment or post-decrement |
|
public class MainClass{
public static void main(String[] argv){
int i = 0;
int y = 0;
y = i++;
System.out.println(i);
System.out.println(y);
}
}
1
0
public class MainClass{
public static void main(String[] argv){
int i = 0;
int y = 0;
y = ++i;
System.out.println(i);
System.out.println(y);
}
}
1
1
public class MainClass{
public static void main(String[] argv){
int i = 0;
int y = 0;
y = i--;
System.out.println(i);
System.out.println(y);
}
}
-1
0
public class MainClass{
public static void main(String[] argv){
int i = 0;
int y = 0;
y = --i;
System.out.println(i);
System.out.println(y);
}
}
-1
-1
|
|
|