arithmetic expression
public class Main {
public static void main(String[] args) {
int x = 3;
int y = 4;
System.out.println("x + y = " + (x + y));
}
The keyword int can define integer type. You can use the equal sign to assign value to the int variable. You can use arithmetic operator + to combine texts and variables. The snippet result is
x + y = 7
Last updated