And that inside them I felt I need to put in my statements.
So as you can see here now this method is showing us an error.
So let's actually hover over the area and see what's this error.
This method must return or results of type float.
OK so the return type of on my feet is flawed and we must return a value of type float.
OK.
Inside that method I just want to create a variable of type float.
OK.
And the name of my variable is resolved and I want to actually subtract the value of the one variable
by the value of the norm too valuable.
OK.
And I can actually return this result by the OK the return type of Meffert is float the name of RMF
it is divided 2 numbers.
And if it is going to actually accept two arguments.
The first argument is of type float and the name of my first argument is now one.
And my second argument is of type float and the name of my argument is number two.
And then inside the method I actually created a variable of type float and the name of my variable is
the result.
And then I assigned the result of this operation here to my body.
OK.
Now one divided by two.
And then in line 56 I returned this result variable.
Ok so this is as variable is of type float and we must return a value of type floats from the Smurfette.
OK because the return type of this method is float.
And that I want to actually call this method from the main method.
So here.
So here because this method returns a value of type float I can actually directly output the value of
that method to the console.
So I just need to type in her system that's out towards Princeton and then inside the prentices I can
just refer to the name of my method.
Divide two numbers and then of to actually pass values to disbenefit So the first value is.
For example 50.
And the second value is for example 15.
OK.
And then at the end of my statement I need to put in a semi-colon.
So now if I run my project as you can see this is the value that is output to the console.
So Fred teep divided by 15 is 2.
OK.
And then I can actually assign the return value of this method to another value of type float.
So I can just type in here.
Float.
OK.
And the name of my variable is result and then I can assign this method to my variable because the Smurfette
returns a value of type float.
So we can actually assign that value to our it.
So I just need to refer to the name of my method.
Divide two numbers and the first value is.
For example 20.
And the second value is for example 2.
OK.
And then I can.
And then I need to put in a semi-colon at the end of my statement and I want to output the value of
this result variable to the console.
So I just need to type in her system start out that print Prince learn and that insight apprentices
I just need to refer to the name of my variable and then I need to put a semi-colon at the end of my
method.
So now if I get on my project as you can see this is the value that is output to the concert numbers
10 20 divided by two is 10.
And in line 23 we are actually outputting data value to the card.
OK so this value is the result of execution of this line of code here.
OK.
So now let me show you another example about MFX.
So I want to create another method here.
So I just need to type in here static and the return type of My method is float and the name of my method
is subtract
numbers.
OK.
And then I want to specify that my method is going to have arguments.
So inside the round brackets I need to put my arguments to the Data Type of my first argument is flawed
and the name of my argument is not a and the Data Type of my second argument is float and the name of
my argument is non B.
And then I need to open and close my method by using an opening curly brace followed by closing curly
braces.
OK.
So inside I'm afraid I can't put my statements so as you can see here it's now showing us an error.
So let's actually hover over the error area and see what's the error.
This method must return a result of type float.
So as you can see here we need to return a value of type floats because the return type of the Smurfette
is float.
So there is another important point here that I want to let you know as you can see here the name of
this method is actually the same as the name of this method.
OK.
So in Java we can actually have different methods but with different arguments.
Ok this method has ains arguments but this method has flawed arguments.
OK the data type of the arguments of this method is named and the data type of the arguments of this
method is flawed.
OK so we can actually have defensemen effets but with defense arguments.
OK so if we can actually have different methods with the same name but with different arguments.
OK we cannot actually have different methods with the same name and with the same arguments.
OK we can actually have for example another method with the same name but without no arguments.
OK so this is a very important point about actually creating it.
My faith in Java.
OK so now I want to actually create a variable here with the floating data type float result and then
I can actually assign a value to my variable.
So now I want to actually assign the result of subtraction of the value of the not a variable from the
value of the not be valuable.
OK so I just need to type in here and am a minus Nahm be OK.
And then I need to put in a semicolon at the end of my statement.
And here I can actually return the result.
OK and then I need to put in a semi-colon at the end of my statement again.
So from the main method I can actually call this method.
OK so inside the main effect I can just type in here.
System that out that Priestland and then inside the method I can actually refer to the name of my method
because this nymphet returns are a value of type float.
We can directly output the return value of this interface to the console.
OK so inside the prentices I can refer to the name of time if it tracked two numbers.
As you can see here it's now showing us two options.
So as you can see these two methods have the same name but different arguments.
OK so you want to choose this method that has arguments with the floating data type.
OK so the value of their first argument is for example to point five and the value of the second argument
is zero point five.
OK and then I need to put in a semi-colon at the end of my statements.
So as you can see here it's now showing us a nasty error.
OK so let's actually posit already area answer in.
If it is not applicable for the arguments.
Double double so as I said earlier in this section you must actually put the F letter at the end of
the numbers in order to actually in order to make those numbers float numbers OK.
Otherwise the eclipse thinks that you are actually using double numbers.
OK so we must actually put the F letter at the end of our numbers.
OK now the error is gone.
OK.
And as you can see this is the value that is output to the consulate.
So 2.5 minus 0.5 is 2.0.
OK so I think that's enough for my efforts.
And if you have any questions please post the discussion in the course and then I'll try my best to
answer your questions.
And thank you very much for watching this tutorial and I'll see you in the next tutorial.