Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

pre increment and post increments

int x =0;
// POST increments: increments after it prints x or stmt  
System.out.println("Hello World"+ x++); // 0 
System.out.println("Hello World"+ x); // 1

// PRE increments: increments before it prints x or stmt  
System.out.println("Hello World"+ ++x); // 1
System.out.println("Hello World"+ x); // 1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #pre #increment #post #increments
ADD COMMENT
Topic
Name
1+5 =