Hello, in this Java programming video, we are going to look at passing in values to functions. So in the previous video if you have not checked out the previous video, which was covering your basic example, on methods functions, feel free to check that out. Okay, so we've got the these couple of functions right here, methods functions, the same thing. So just to make sure that confusing, so we got these two functions right now, which are obviously variable. So what we can actually do is pass a value in to this function. So if for example, I do it with the void, what we can do in between brackets, any values we want to pass in, we have to specify the data type something is the same, nothing, no change of bit float, then you name your variable.
So let's say for one, and that's it, and obviously this is, you know, Given an error, because it is saying he can't find a method called function, one that takes no, you know, money, but this 1.5 and F at the end. So it's float, still saying five, that's because we haven't done anything here, while one now. And when we get 6.5 pretty damn cool, we can extend it further. So you can have more than one value, you can have as many as you want really. So like comma, then against that for the data type does not have to be the same data type bear in mind. So I'm just going to keep it in the same box or recommend experiment and I'm using a different one.
So if I say var two in here on the wall one times Vol. Two and I pass in a second on this zero so this should be 32. And they have 32.5 have been printed out. So that's how you pass in values. Honestly, there really isn't much to it than that. Because you could pass on anybody that you want to the Matter What It Is any data type, just name it the way you normally would.
And then you just use it here. It's really, let's say, obviously, you could have it in here as well. And as an extra four I'm gonna set for you in order to create like a calculator for a little computation. But I want you to have four methods. One's called multiply one cool addition, one call subtraction, I think he has the last one division, each one takes in two values, and you just perform the operations or you multiply the numbers together or a subtract the two numbers are first taken second, or we add them or you know, do the division for the first one, take away the second one and then call each one of those methods. Then go step further.
And for the division method, try and prevent division by zero. Give you a little clue. You need something like an St. Paul, leave that to you. If you have any questions regarding that, feel free to reach out, and I look forward to seeing you in the next awesome Java video.