0
Please anybody can explain about increment/decrement operator process in java ??
3 Respostas
+ 2
Increment (++) - Adds 1 to a current value.
Example: 5++;
This will become 6.
Decrement (--) - Decreases 1 to a current value.
Example: 5--;
This will become 4.
+ 1
okk
0
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
//taking initial score
int initScore = scanner.nextInt();
int scoreTom = initScore;
int scoreBob = initScore;
System.out.println("Round 1 results:");
//fix
++ scoreTom ;
-- scoreBob ;
System.out.println(scoreTom++);
System.out.println(scoreBob--);
}
}