Okay in Java, we also have these meta. So meta will allow us to, let's say, use our code in the whole source code. So let's say I have a method here. I say I put public void. And then I put, let's see. Let's see.
Display. Display Hello, lower. I pull something like this. This reload and system dot out. dot println. ly Apple Hello.
Okay, yeah, I can use these method in this main method here a few time So I can pull something like this spray. Hello, we're okay I can put in a few time t is showing me some error non steady method because this main method is static here. So we need to change these tools that do so. Okay, now it should work. So I run the project. So I should get by Holloway here.
So as you can see, this method in Java allows us to RLC we usually reuse all the code in our other saltwater source code. So I reuse these method a few times indeed. Main method here in method This is the modifier public and then this is a status that is because this main method is static, then what what means I return nothing and then display Holloway is the method name and then the parameter is actually empty and then this is the code that will be to be executed. Okay. So if let's say I want to create a meta, we return type, I can do something that is very steady again. Why I changed to let's say, double fro, I changed to double.
I see our calculations some subtraction, subtraction, then a pu r let's see. Ah Dabba number one Dabba number two. Okay? So I can do something that double result equal number one minus number two and I return visa. So I can call this suppression inside here. I can call it ID subtraction as the number one I put 1.0 number two I put 5.0 and I can call you a few times also.
Okay, that's e 2.0 and 3.0. Okay, I can call you one more time. So, one point is Oh, I see this change too. 7.0 okay I run the project okay I again Ah printer result okay a return result okay. So let's see ba ah is equal subtraction here, System dot out dot print line is okay I do these result to System dot out dot println ly result two I can do double result tree a K system dot dot print line result tree okay I run the project k 4.0 1.0 6.0 or negative. So, one minus by negative four to minus three is negative once one minus seven is negative six.
So, when I call this subtraction method, so, this method is published at double So, he will return double data type your return a double data type or double variable here then subtraction is the method name, double number one double number two this is the what they call the arguments or the parameters. So, when I call this sub sub structure method here 1.0 is passed to this number one 5.0 is passed to this and number two. So, number one is 1.0 number two is 5.0. So, a number one minus number two will be 1.0 minus 5.0 and then I return this result. So, I will get, so, this method will return a resolve is after this calculation here, then the result will be passed to this double variable here and I print out these result here and I can call this method a few times. So, in Java programming when I create a meta, the method does not need to return the type parameter Okay it can the return type and this parameter or it can also have return type but no parameter or you can have no return type and have parameters here.
So, it is up to us to write these method