Answers for "increment variable java"

2

increment java

int i = 5;
  i++;
// i = 6
Posted by: Guest on March-02-2021
0

java increments

// you can use two types of increments
int x = 0;
//Postincrement
System.out.println(x++); //this prints 0 because increments after execute print
//Pretincrement      // x = 1 and + 1 again is equal to 2 in the second print
System.out.println(++x); // this prints 2 because increments before execute print
Posted by: Guest on August-10-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language