CSS font stacks & developer FAQs with Web standards
Site navigation below

One of hundreds of answers available with our premium content service.

Part answer, see below for more

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

Click for full answers

Premium members click below for full answer
How do I add two numbers in Java?

Un-social media

We love social media, but we do not expect you to create yet another public outpost on the Web.

Home · Web fonts · Font stacks · FAQs · Java · CSS · Javascript · HTML · Site manager