Jumat, 05 April 2013

Contoh Program Java Increment


class DemoIncrement {
  public static void main(String[] args) {


    int a=5;

    System.out.println("Pre-increment");
    System.out.println("a\t: " + a);
    System.out.println("++a\t: " + ++a);
    System.out.println("a\t: " + a);

    int b=5;

    System.out.println("\nPost-increment");
    System.out.println("b\t: " + b);
    System.out.println("b++\t: " + b++);
    System.out.println("b\t: " + b);
  }
}

Tidak ada komentar:

Posting Komentar