Incrementing and Decrementing : Operators « JSP « Java Tutorial






<HTML>
  <HEAD>
    <TITLE>Incrementing and Decrementing</TITLE>
  </HEAD>

  <BODY>
    <H1>Incrementing and Decrementing</H1>
    <%
        int int1 = 0, int2 = 0;

        out.println("int1 = " + int1 + "<BR>");
        out.println("int2 = " + int2 + "<BR>");


        int2 = int1++;

        out.println("After <B>int2 = int1++</B>:" + "<BR>");
        out.println("int1 = " + int1 + "<BR>");
        out.println("int2 = " + int2 + "<BR>");

        int value3 = 0, value4 = 0;

        out.println("<BR>");
        out.println("value3 = " + value3 + "<BR>");
        out.println("value4 = " + value4 + "<BR>");

        value4 = ++value3;

        out.println("After <B>value4 = ++value3</B>:" + "<BR>");
        out.println("value3 = " + value3 + "<BR>");
        out.println("value4 = " + value4 + "<BR>");
     %>
  </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