3.5 Example variables

In the previous video, we saw different types of variables and in this course we are going to manipulate 2 of them, so are you ready? Let’s go, let’s go! First, we will delete that, then we will create a variable of the int type, which will be called num and we will assign it the value 5. Here we will display it, we type sout which is an abbreviation in intellij, we press the tab key, in fact it allows us to avoid writing all that. Between the parenthesis, we will write the name, when it is a variable name, we must avoid putting quotation marks otherwise it will display the name or we want the value 5, so we must put it without quotation marks. As we can see we have the value 5. Here we will create another variable which is of the double type we will give it as name number, then we will put the value 10. We’re posting it. And as we can see here, we have a number after, so the difference between int and double is that int is an integer, so a number without comma whereas double is a number with comma. We will do a small calculation on the int and the double thanks to the operators, there are many operators but there are 4 that you normally know, including the addition, subtraction, multiplication and division. So here we are going to do 5 + 20 – 5 for example. And here we are going to do 10 * 3 / 5.2 Well listened is all for this video, I really showed you the easiest, it more complex than that. So in the next video we’ll see what the operators are! Go to the next one.