0

Please anybody can explain about increment/decrement operator process in java ??

13th Sep 2018, 2:18 AM
Raja Sekar
Raja Sekar - avatar
5 odpowiedzi
+ 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.
13th Sep 2018, 4:31 AM
Email Not Activated
+ 1
okk
13th Sep 2018, 6:01 AM
Raja Sekar
Raja Sekar - avatar
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--); } }
20th Dec 2021, 4:13 AM
MN FATHIMA RIHAM - s92064451 -321424451
MN FATHIMA RIHAM - s92064451 -321424451 - avatar