Back To Home

Tutorial #5

Learning to use variables

Now that you have learned to create a variable in java we will create our first math equation. To start we need the following code:

int MyVar = 10; Now we will use this to make a math equation. if (MyVar == 10) { System.out.println("This is working"); } which means if the variable is = to 10 then we will run System.out.println to say that it works! There is many different types of math so here are the following symbols used for math equations. Remember you can always do something like int NewINT = MyVar + 10; to get 20.