Question: Adding (incrementing) or subtracting (decrementing) the value one from an integer variable is a common, everyday operation. To increment an int variable x, we could
Adding (incrementing) or subtracting (decrementing) the value one from an integer variable is a common, everyday operation. To increment an int variable x, we could code x = x + 1; As an alternative, we could use the special operators ++ and -- to increment and decrement a variable. Use the first method to increment x in the program below. Print the value of x after incrementing. Use the ++ operator to increment in the program below. Print the value of y after incrementing. public class Increment Demo public static void main(String[] args) {int x = 10: int y = 3;//Put your code here}}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
