public class Main {
	public static void main(String[] args) {
	    int a;
	    int b;
	    a = 20;
	    b =a+5;
		System.out.println(a);
		System.out.println(b);
	}
}
Execution result
20
25
Something like the 6th line is called an expression. "A", "b" and "5" are called operands, and "+" and "*" are called operators. Even if it is a complicated formula, all the formulas consist of these two.
Among operants, what is described in the source code such as "5" and "hello, world" is called a literal. Literals have data types such as (int).
A special character is represented by a description method that is described by the \ symbol followed by a single character.
| Notation | meaning | 
|---|---|
| ¥” | Double quote symbol | 
| ¥ ’ | Quote symbol | 
| ¥¥ | Yen sign | 
| ¥n | new line | 
| operator | function | 
|---|---|
| + | addition | 
| - | subtraction | 
| * | multiplication | 
| / | division | 
| % | Remainder of division (remainder) | 
| + | String concatenation | 
| = | Substitute the right side for the left side | 
| += | Add the left side and the right side and assign to the left side (as per the arithmetic operator) | 
| ++ | Increase the value by one | 
| --- | Decrease the value by one | 
Recommended Posts