Skip to content
CodeKruPro

i++ versus ++i

Predict the outputEasyJava onlyAsked in: Infosys, PhonePe, Wipro
Main.java
public class Main {
    public static void main(String[] args) {
        int i = 5;
        int a = i++;
        int b = ++i;
        System.out.println(a + " " + b + " " + i);
    }
}

Graded by exact match. Spaces at the ends of lines and blank lines at the end do not count.

to answer and keep your progress. Reading is free for everyone.