Using ++ in java

Using ++ in java
0

#1

Tell us what’s happening:

Your code so far

var myVar = 87;

// Only change code below this line
i = myVar - 1 +1;
myVar = ++i;



Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36.

Link to the challenge:


#2

The instructions state “Change the code to use the ++ operator on myVar”

If you notice in their example (shown below), they increment the value of i by 1 using i++;

i++;

All you need to do is increment the value of myVar by 1 by putting ++ on the end of it. You currently have ++ in front of myVar. Also, you DO NOTneed the following line in your code:

i = myVar - 1 +1;