Addition and Subtraction : Operators « JSP « Java Tutorial






<HTML>
  <HEAD>
    <TITLE>Addition and Subtraction</TITLE>
  </HEAD>

  <BODY>
    <H1>Addition and Subtraction</H1>
    <%
        int operand1 = 15, operand2 = 24, sum, difference;

        sum = operand1 + operand2;
        difference = operand1 - operand2;

        out.println(operand1 + " + " + operand2 + " = " + sum + "<BR>");
        out.println(operand1 + " - " + operand2 + " = " + difference);
     %>
  </BODY>
</HTML>








23.13.Operators
23.13.1.Using Operators
23.13.2.Incrementing and Decrementing
23.13.3.Multiplication and Division
23.13.4.Addition and Subtraction
23.13.5.Using Relational Operators
23.13.6.Using Logical Operators
23.13.7.Checking Operator Precedence