Java Arithmetic Operator Question 5

Question

What is the output of the following code?

public class Main {
  public static void main(String[] args) {
    int a = 6; /* w w  w.  j a  v  a2s .  c o m*/
    int b = a++; 
    System.out.println(a); 
    System.out.println(b); 
    a = 6; 
    b = ++a; 
    System.out.println(a); 
    System.out.println(b); 

  }
}


7
6
7
7



PreviousNext

Related