1.7 Basic Arithmetic
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
Already have an account? Sign In »
4 hours 19 minutes
Hi and welcome back to the course. Now, In the last video, we went over data types in variables in Java and in this video we're gonna be talking about some basic Earth medic in Java.
Now, before we get into the actual video, elector, I'm going to inform me that this video lecture is gonna be shorter than usual because there isn't a lot to cover about arithmetic in Java. But here are some learning objectives. So essentially we want to understand what basic arithmetic in Java is and what mathematical operators
can be used as well as which one of those are valid
to be used in Java.
So here is a list of operators on dhe. If you look at the left hand side, there is Theoden operator and its use. So if we have, for example, a variable called X and a variable called y, it adds X and y together and here is an example with actual numbers.
The same goes for a subtraction of two variables X and y,
and why is being subtracted from X?
Then you have something called negation which basically trains your positive integer number into its negative form as you can see over here on the right hand side. So you have 10. And then if you apply the negation operator on it, you get minus 10. Then you have multiplication without which obviously multiplies
And then after that, you have a division,
and finally we have the modular operator. Now, the modular operator is something that not a lot of people know about. But essentially all it does is it gives you back or returns the remainder of your division. So let's say we're dividing 20 by 30. We know that six goes into
23 times, so six times three is 18
and our remainder is too. So that remainder of two is what the module oh, operator will be giving us.
So to summarize what we went over in this video lecture, we discussed some basic arithmetic and java and what mathematical operators we can use in Java.
Now in the video coming up next, we're gonna be discussing accepting user input and just to say, a quick note about what we just went over today. These operators are always used in a variety of programs, and we're gonna be using these operators not all of them, but some of them in the videos coming up shortly.
So just keep an eye out for that.
And if you have any questions at all, or if you want to get with me, you can feel free to join my Lincoln below. And I would be more than happy to answer any questions that you have at all. Thank you very much for watching, and I look forward to seeing you in the next video.