Java examples for Language Basics:Operator
How to use Java arithmetic assignment operators like +=, -=, *= and /=.
public class Main { public static void main(String[] args) { int i = 5; int j = 10; //from w w w . j ava 2 s .co m i += 5; //same as i = i + 5 j -= 2; //same as j = j - 2 System.out.println("i = " + i); System.out.println("j = " + j); } }