Abbreviation Operators in Java

Abbreviation Operators are shorthand operator in Java.

What is Operators?

Operators are constructs defined within programming languages which behave generally like functions, but which differ syntactically or semantically.

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

        int answer = 0;
        answer++;
        System.out.println(answer);
        answer--;
        System.out.println(answer);
        System.out.println(answer+=3);
        System.out.println(answer*=10);
        System.out.println(answer/=3);
        System.out.println(answer-=3);
        System.out.println(answer%=5);
    }
}
1
0
3
30
10
7
2

Leave a Reply

Your email address will not be published.

ANOTE.DEV