public class Increment {
public static void main (String args[]){
int x,y;
x=5;
y=8 - x++;//dibaca int awal, baru di naikkan
System.out.println("Contoh 1");
System.out.println("x="+x+","+"y="+y);
x=5;
y=8 - ++x;//dinaikkan, baru dibaca
System.out.println("Contoh 2");
System.out.println("x="+x+","+"y="+y);
}
}
Output :
Contoh 1
x=6,y=3
Contoh 2
x=6,y=2
x=6,y=3
Contoh 2
x=6,y=2
0 Komentar
Penulisan markup di komentar