1.7 Basic Arithmetic

Video Activity
Join over 3 million cybersecurity professionals advancing their career
Sign up with
Required fields are marked with an *
or

Already have an account? Sign In »

Time
4 hours 19 minutes
Difficulty
Beginner
CEU/CPE
4
Video Transcription
00:00
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.
00:12
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
00:32
can be used as well as which one of those are valid
00:35
to be used in Java.
00:38
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.
00:57
The same goes for a subtraction of two variables X and y,
01:00
and why is being subtracted from X?
01:03
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
01:23
expert, why?
01:25
And then after that, you have a division,
01:29
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
01:49
23 times, so six times three is 18
01:52
and our remainder is too. So that remainder of two is what the module oh, operator will be giving us.
02:01
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.
02:13
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.
02:31
So just keep an eye out for that.
02:36
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.
Up Next