Friday 15 September 2017

Java Initialization and Increment Expressions

Cited from the Book Java How to Program

The initialization and increment expressions can be comma-separated lists that enable you to use multiple initialization expressions or multiple increment expressions. However, this is discouraged.

For example,

for ( int number = 2; number <= 20;
    total += number, number += 2 )
        ; // empty statement

No comments:

Post a Comment