Biblioteca Java - Blame information for rev 39
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
39 | mihai | 1 | package introducere.java.operator; |
4 | mihai | 2 | |
3 | /** | ||
4 | * The following program, ArithmeticDemo, tests the arithmetic operators. | ||
5 | */ | ||
6 | class ArithmeticDemo { | ||
7 | |||
8 | public static void main (String[] args){ | ||
9 | |||
10 | int result = 1 + 2; // result is now 3 | ||
11 | System.out.println(result); | ||
12 | |||
13 | result = result - 1; // result is now 2 | ||
14 | System.out.println(result); | ||
15 | |||
16 | result = result * 2; // result is now 4 | ||
17 | System.out.println(result); | ||
18 | |||
19 | result = result / 2; // result is now 2 | ||
20 | System.out.println(result); | ||
21 | |||
22 | result = result + 8; // result is now 10 | ||
23 | result = result % 7; // result is now 3 | ||
24 | System.out.println(result); | ||
25 | |||
26 | } | ||
27 | } |