One of hundreds of answers available with our premium content service.
A: To add two numbers in Java, use the simple mathematical plus operator, which may be applied to any numeric variable type, as below:
int variable1 = 26;
int variable2 = 4;
int result = variable1 + variable2;
The result of the addition does not have to be assigned to a variable, it can also be used anonymously in control statements, as below.
… full answer hidden
Premium members click below for full answer
How do I add two numbers in Java?
We love social media, but we do not expect you to create yet another public outpost on the Web.