public class MainClass {
public static void main(String[] argv) {
int x = 5;
int y = x++; // y gets the value 5, before incrementing x
int y2 = ++x; // y2 gets the value 7, after incrementing
}
}
public class MainClass{
public static void main(){
//The ++ and -- operators modify the value of an expression by adding or subtracting 1.
int i=0;
i++;
System.out.println(i);
--i;
System.out.println(i);
}
}
|