1
00:00:00,210 --> 00:00:03,730
And that inside them I felt I need to put in my statements.

2
00:00:03,840 --> 00:00:08,040
So as you can see here now this method is showing us an error.

3
00:00:08,040 --> 00:00:12,120
So let's actually hover over the area and see what's this error.

4
00:00:12,180 --> 00:00:15,610
This method must return or results of type float.

5
00:00:15,630 --> 00:00:22,990
OK so the return type of on my feet is flawed and we must return a value of type float.

6
00:00:23,010 --> 00:00:23,460
OK.

7
00:00:23,490 --> 00:00:28,390
Inside that method I just want to create a variable of type float.

8
00:00:28,680 --> 00:00:29,400
OK.

9
00:00:29,610 --> 00:00:37,530
And the name of my variable is resolved and I want to actually subtract the value of the one variable

10
00:00:37,920 --> 00:00:40,250
by the value of the norm too valuable.

11
00:00:40,370 --> 00:00:40,820
OK.

12
00:00:40,890 --> 00:00:41,410
OK.

13
00:00:41,550 --> 00:00:52,420
And I can actually return this result by the OK the return type of Meffert is float the name of RMF

14
00:00:52,420 --> 00:00:54,160
it is divided 2 numbers.

15
00:00:54,370 --> 00:00:57,780
And if it is going to actually accept two arguments.

16
00:00:57,780 --> 00:01:02,910
The first argument is of type float and the name of my first argument is now one.

17
00:01:02,940 --> 00:01:08,740
And my second argument is of type float and the name of my argument is number two.

18
00:01:09,180 --> 00:01:16,510
And then inside the method I actually created a variable of type float and the name of my variable is

19
00:01:16,510 --> 00:01:17,240
the result.

20
00:01:17,520 --> 00:01:22,810
And then I assigned the result of this operation here to my body.

21
00:01:22,900 --> 00:01:23,520
OK.

22
00:01:23,670 --> 00:01:25,370
Now one divided by two.

23
00:01:25,410 --> 00:01:29,830
And then in line 56 I returned this result variable.

24
00:01:29,850 --> 00:01:37,210
Ok so this is as variable is of type float and we must return a value of type floats from the Smurfette.

25
00:01:37,230 --> 00:01:41,170
OK because the return type of this method is float.

26
00:01:41,610 --> 00:01:44,620
And that I want to actually call this method from the main method.

27
00:01:44,790 --> 00:01:45,510
So here.

28
00:01:45,510 --> 00:01:52,620
So here because this method returns a value of type float I can actually directly output the value of

29
00:01:52,620 --> 00:01:53,970
that method to the console.

30
00:01:54,120 --> 00:02:02,630
So I just need to type in her system that's out towards Princeton and then inside the prentices I can

31
00:02:02,630 --> 00:02:04,620
just refer to the name of my method.

32
00:02:04,640 --> 00:02:11,010
Divide two numbers and then of to actually pass values to disbenefit So the first value is.

33
00:02:11,060 --> 00:02:12,480
For example 50.

34
00:02:12,560 --> 00:02:16,060
And the second value is for example 15.

35
00:02:16,130 --> 00:02:16,670
OK.

36
00:02:16,760 --> 00:02:20,190
And then at the end of my statement I need to put in a semi-colon.

37
00:02:20,480 --> 00:02:26,550
So now if I run my project as you can see this is the value that is output to the console.

38
00:02:26,570 --> 00:02:29,730
So Fred teep divided by 15 is 2.

39
00:02:29,860 --> 00:02:30,410
OK.

40
00:02:30,410 --> 00:02:35,650
And then I can actually assign the return value of this method to another value of type float.

41
00:02:35,750 --> 00:02:36,890
So I can just type in here.

42
00:02:36,890 --> 00:02:37,560
Float.

43
00:02:37,730 --> 00:02:38,490
OK.

44
00:02:38,810 --> 00:02:47,360
And the name of my variable is result and then I can assign this method to my variable because the Smurfette

45
00:02:47,660 --> 00:02:50,110
returns a value of type float.

46
00:02:50,120 --> 00:02:54,040
So we can actually assign that value to our it.

47
00:02:54,050 --> 00:02:56,230
So I just need to refer to the name of my method.

48
00:02:56,270 --> 00:03:00,170
Divide two numbers and the first value is.

49
00:03:00,170 --> 00:03:01,830
For example 20.

50
00:03:01,970 --> 00:03:04,710
And the second value is for example 2.

51
00:03:04,760 --> 00:03:05,390
OK.

52
00:03:05,600 --> 00:03:06,630
And then I can.

53
00:03:06,740 --> 00:03:12,680
And then I need to put in a semi-colon at the end of my statement and I want to output the value of

54
00:03:12,680 --> 00:03:14,660
this result variable to the console.

55
00:03:14,660 --> 00:03:22,850
So I just need to type in her system start out that print Prince learn and that insight apprentices

56
00:03:22,910 --> 00:03:28,010
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

57
00:03:28,010 --> 00:03:28,600
method.

58
00:03:28,820 --> 00:03:34,130
So now if I get on my project as you can see this is the value that is output to the concert numbers

59
00:03:34,130 --> 00:03:36,560
10 20 divided by two is 10.

60
00:03:36,800 --> 00:03:41,220
And in line 23 we are actually outputting data value to the card.

61
00:03:41,270 --> 00:03:45,270
OK so this value is the result of execution of this line of code here.

62
00:03:45,290 --> 00:03:45,910
OK.

63
00:03:46,040 --> 00:03:49,040
So now let me show you another example about MFX.

64
00:03:49,100 --> 00:03:51,340
So I want to create another method here.

65
00:03:51,350 --> 00:04:00,290
So I just need to type in here static and the return type of My method is float and the name of my method

66
00:04:00,350 --> 00:04:01,430
is subtract

67
00:04:04,780 --> 00:04:06,280
numbers.

68
00:04:06,380 --> 00:04:08,010
OK.

69
00:04:08,420 --> 00:04:12,660
And then I want to specify that my method is going to have arguments.

70
00:04:12,710 --> 00:04:19,090
So inside the round brackets I need to put my arguments to the Data Type of my first argument is flawed

71
00:04:20,060 --> 00:04:28,730
and the name of my argument is not a and the Data Type of my second argument is float and the name of

72
00:04:28,730 --> 00:04:31,250
my argument is non B.

73
00:04:31,760 --> 00:04:37,830
And then I need to open and close my method by using an opening curly brace followed by closing curly

74
00:04:37,830 --> 00:04:38,140
braces.

75
00:04:38,140 --> 00:04:38,820
OK.

76
00:04:38,900 --> 00:04:44,690
So inside I'm afraid I can't put my statements so as you can see here it's now showing us an error.

77
00:04:44,690 --> 00:04:49,710
So let's actually hover over the error area and see what's the error.

78
00:04:50,430 --> 00:04:53,930
This method must return a result of type float.

79
00:04:54,230 --> 00:05:00,800
So as you can see here we need to return a value of type floats because the return type of the Smurfette

80
00:05:00,860 --> 00:05:02,000
is float.

81
00:05:02,330 --> 00:05:08,510
So there is another important point here that I want to let you know as you can see here the name of

82
00:05:08,510 --> 00:05:12,420
this method is actually the same as the name of this method.

83
00:05:12,470 --> 00:05:13,050
OK.

84
00:05:13,310 --> 00:05:18,010
So in Java we can actually have different methods but with different arguments.

85
00:05:18,020 --> 00:05:23,680
Ok this method has ains arguments but this method has flawed arguments.

86
00:05:23,710 --> 00:05:29,900
OK the data type of the arguments of this method is named and the data type of the arguments of this

87
00:05:29,900 --> 00:05:31,150
method is flawed.

88
00:05:31,320 --> 00:05:37,720
OK so we can actually have defensemen effets but with defense arguments.

89
00:05:37,740 --> 00:05:43,000
OK so if we can actually have different methods with the same name but with different arguments.

90
00:05:43,010 --> 00:05:48,980
OK we cannot actually have different methods with the same name and with the same arguments.

91
00:05:48,980 --> 00:05:56,620
OK we can actually have for example another method with the same name but without no arguments.

92
00:05:56,780 --> 00:06:01,990
OK so this is a very important point about actually creating it.

93
00:06:02,000 --> 00:06:03,000
My faith in Java.

94
00:06:03,000 --> 00:06:10,850
OK so now I want to actually create a variable here with the floating data type float result and then

95
00:06:10,940 --> 00:06:13,300
I can actually assign a value to my variable.

96
00:06:13,310 --> 00:06:20,030
So now I want to actually assign the result of subtraction of the value of the not a variable from the

97
00:06:20,030 --> 00:06:21,750
value of the not be valuable.

98
00:06:21,770 --> 00:06:28,140
OK so I just need to type in here and am a minus Nahm be OK.

99
00:06:28,310 --> 00:06:31,260
And then I need to put in a semicolon at the end of my statement.

100
00:06:31,610 --> 00:06:35,250
And here I can actually return the result.

101
00:06:35,660 --> 00:06:40,310
OK and then I need to put in a semi-colon at the end of my statement again.

102
00:06:40,340 --> 00:06:43,810
So from the main method I can actually call this method.

103
00:06:43,910 --> 00:06:48,270
OK so inside the main effect I can just type in here.

104
00:06:48,280 --> 00:06:57,050
System that out that Priestland and then inside the method I can actually refer to the name of my method

105
00:06:57,080 --> 00:07:01,700
because this nymphet returns are a value of type float.

106
00:07:01,750 --> 00:07:05,930
We can directly output the return value of this interface to the console.

107
00:07:05,930 --> 00:07:12,210
OK so inside the prentices I can refer to the name of time if it tracked two numbers.

108
00:07:12,230 --> 00:07:15,160
As you can see here it's now showing us two options.

109
00:07:15,440 --> 00:07:20,300
So as you can see these two methods have the same name but different arguments.

110
00:07:20,310 --> 00:07:28,130
OK so you want to choose this method that has arguments with the floating data type.

111
00:07:28,130 --> 00:07:38,270
OK so the value of their first argument is for example to point five and the value of the second argument

112
00:07:38,360 --> 00:07:40,020
is zero point five.

113
00:07:40,080 --> 00:07:43,910
OK and then I need to put in a semi-colon at the end of my statements.

114
00:07:44,300 --> 00:07:47,820
So as you can see here it's now showing us a nasty error.

115
00:07:47,870 --> 00:07:51,720
OK so let's actually posit already area answer in.

116
00:07:51,780 --> 00:07:54,830
If it is not applicable for the arguments.

117
00:07:54,830 --> 00:08:02,030
Double double so as I said earlier in this section you must actually put the F letter at the end of

118
00:08:02,030 --> 00:08:10,030
the numbers in order to actually in order to make those numbers float numbers OK.

119
00:08:10,310 --> 00:08:15,580
Otherwise the eclipse thinks that you are actually using double numbers.

120
00:08:15,610 --> 00:08:21,940
OK so we must actually put the F letter at the end of our numbers.

121
00:08:22,350 --> 00:08:24,200
OK now the error is gone.

122
00:08:24,270 --> 00:08:24,810
OK.

123
00:08:24,910 --> 00:08:29,140
And as you can see this is the value that is output to the consulate.

124
00:08:29,310 --> 00:08:33,620
So 2.5 minus 0.5 is 2.0.

125
00:08:33,660 --> 00:08:36,520
OK so I think that's enough for my efforts.

126
00:08:36,780 --> 00:08:42,630
And if you have any questions please post the discussion in the course and then I'll try my best to

127
00:08:42,630 --> 00:08:44,500
answer your questions.

128
00:08:44,820 --> 00:08:50,380
And thank you very much for watching this tutorial and I'll see you in the next tutorial.

