1
00:00:00,210 --> 00:00:04,410
For example Mefford one.

2
00:00:04,680 --> 00:00:05,240
OK.

3
00:00:05,430 --> 00:00:08,860
And then I need to put in a semi-colon at the end of my statement.

4
00:00:08,930 --> 00:00:14,210
OK so now I want to actually call the Smurfette from the main effect of this main class.

5
00:00:14,220 --> 00:00:14,640
OK.

6
00:00:14,670 --> 00:00:21,240
So now let me actually comment out these lines of code here because I don't want to execute these lines

7
00:00:21,240 --> 00:00:21,900
of code.

8
00:00:22,070 --> 00:00:22,780
OK.

9
00:00:23,100 --> 00:00:26,710
And then I want to actually call the Smurfette from the main method.

10
00:00:26,940 --> 00:00:31,730
So I just need to refer to the name of mine if it Mefford one.

11
00:00:32,240 --> 00:00:33,200
OK.

12
00:00:33,660 --> 00:00:37,810
And then I need to put in a pair of round brackets after my method name.

13
00:00:38,250 --> 00:00:41,280
So as you can see here it's now showing us an error.

14
00:00:41,310 --> 00:00:47,730
So let's actually hover over the error area and see what's the error cannot make a static reference

15
00:00:48,480 --> 00:00:52,620
to the non-static method one from that type main.

16
00:00:52,830 --> 00:00:56,160
So as you can see here we cannot actually fare through this method.

17
00:00:56,160 --> 00:00:56,580
Why.

18
00:00:56,580 --> 00:00:59,040
Because this it is not static.

19
00:00:59,250 --> 00:01:04,710
Because we are calling this method from the main method of this class.

20
00:01:04,800 --> 00:01:05,360
OK.

21
00:01:05,490 --> 00:01:10,350
So the pointer to this method is our main class.

22
00:01:10,500 --> 00:01:18,860
So in other words if we actually put the static keyword here now the error is gone.

23
00:01:18,900 --> 00:01:23,110
OK now we can actually call this Smurfette from the main method.

24
00:01:23,160 --> 00:01:23,590
OK.

25
00:01:23,610 --> 00:01:30,360
So as you can see here in order to column A fit inside our main method inside our main class we need

26
00:01:30,360 --> 00:01:37,380
to make that specific method a static method or or in other words a class method so that we can actually

27
00:01:37,380 --> 00:01:40,060
referred to that method inside.

28
00:01:40,140 --> 00:01:41,480
Our main method.

29
00:01:41,490 --> 00:01:44,080
Ok this main method is a static method.

30
00:01:44,100 --> 00:01:44,730
OK.

31
00:01:44,880 --> 00:01:48,720
This means that this method is a class method.

32
00:01:48,960 --> 00:01:55,970
So we must actually make this method a class my Fed in order to call this method from this main method.

33
00:01:55,980 --> 00:01:56,720
OK.

34
00:01:57,180 --> 00:01:58,940
So this is very important.

35
00:01:59,220 --> 00:02:07,670
And another important point that I want to touch about is about this system that out that princeling.

36
00:02:07,970 --> 00:02:08,450
OK.

37
00:02:08,550 --> 00:02:14,460
I actually told you that this is the job was very easy in order to output some values to the console.

38
00:02:14,640 --> 00:02:22,080
But now that you know more about classes objects and methods now you can understand what does this statement

39
00:02:22,080 --> 00:02:22,930
mean.

40
00:02:22,950 --> 00:02:25,950
So this system here is a class.

41
00:02:25,950 --> 00:02:26,470
OK.

42
00:02:26,640 --> 00:02:34,380
So now if we actually hover my mouse pointer over this vote here as you can see it says the system class

43
00:02:34,500 --> 00:02:38,260
contains several useful class fields and methods.

44
00:02:38,370 --> 00:02:39,050
OK.

45
00:02:39,420 --> 00:02:41,360
And it cannot be instantiated.

46
00:02:41,370 --> 00:02:44,320
So now we know this system is a class.

47
00:02:44,370 --> 00:02:45,080
OK.

48
00:02:45,420 --> 00:02:54,340
And as you know already a dot operator here as you can see the dot operator can only be used to call

49
00:02:54,340 --> 00:02:56,420
the methods and variables.

50
00:02:56,550 --> 00:03:01,390
So we know that out must be either a method or a variable.

51
00:03:01,440 --> 00:03:06,050
So this out is either a method or a variable.

52
00:03:06,150 --> 00:03:06,860
OK.

53
00:03:07,020 --> 00:03:14,050
Because we used this dot operator here we just referred to the name of our class system dot.

54
00:03:14,220 --> 00:03:18,480
So this out must be our method or our variable.

55
00:03:18,790 --> 00:03:28,650
Ok so how do we actually identify whether this out of is a variable or if it does so out is not a method

56
00:03:28,770 --> 00:03:35,490
because of the fact that there are no Prentice's after our word here after this.

57
00:03:35,490 --> 00:03:37,580
Out here as you can see.

58
00:03:37,650 --> 00:03:43,430
Remember that whenever you call him F-ed you need to put a parenthesis after your name.

59
00:03:43,530 --> 00:03:47,100
So there is no parenthesis after our vote here after this.

60
00:03:47,090 --> 00:03:52,520
Out so this out here is not MF it so it must be of valuable.

61
00:03:52,740 --> 00:03:56,240
OK so we know that out is valuable.

62
00:03:56,280 --> 00:04:01,350
So we must now ask ourselves what kind of variable is it.

63
00:04:01,350 --> 00:04:02,830
There are two possibilities.

64
00:04:03,000 --> 00:04:11,910
It could be it could be a static or an instance variable because out is being called a system class

65
00:04:12,210 --> 00:04:17,880
name itself and not an instance of a class an object for example.

66
00:04:17,880 --> 00:04:21,810
Then we know that out must be a static variable.

67
00:04:21,960 --> 00:04:29,400
Ok so since only static variables can be called with just the class name itself.

68
00:04:29,490 --> 00:04:33,630
So this out here is our static variable.

69
00:04:33,710 --> 00:04:41,440
Ok so now we know that out is a static variable belonging to the system class.

70
00:04:41,520 --> 00:04:42,110
OK.

71
00:04:42,190 --> 00:04:47,600
Now as you can see here we've got this prince Len method here because there are Prentice's after this

72
00:04:47,950 --> 00:04:49,230
printed in here.

73
00:04:49,350 --> 00:04:51,090
This print plant is a method.

74
00:04:51,310 --> 00:04:55,950
Ok this out is a static variable belonging to the class system.

75
00:04:56,070 --> 00:05:02,280
But now we can see that out must be an instance of a class.

76
00:05:02,340 --> 00:05:02,950
Why.

77
00:05:02,970 --> 00:05:06,020
Because it is invoking the Meffert princeling.

78
00:05:06,200 --> 00:05:06,720
OK.

79
00:05:06,900 --> 00:05:11,450
So this out here must be and is an instance of a class.

80
00:05:11,490 --> 00:05:18,420
So now as you can see if I hover my mouse pointer over and this up and vote here out it says print stream

81
00:05:18,660 --> 00:05:21,130
Java that land that system that out.

82
00:05:21,180 --> 00:05:21,780
OK.

83
00:05:22,020 --> 00:05:27,070
So it this out here is up is an instance of the print stream class.

84
00:05:27,230 --> 00:05:28,030
OK.

85
00:05:28,500 --> 00:05:31,250
That is inside the job without the large package.

86
00:05:31,650 --> 00:05:38,280
So as you can see here it says the standard output stream this stream is already open and ready to accept

87
00:05:38,340 --> 00:05:39,570
output data.

88
00:05:39,750 --> 00:05:40,380
OK.

89
00:05:40,380 --> 00:05:48,210
Typically this stream corresponds to display out food or another output destination specified by the

90
00:05:48,210 --> 00:05:50,380
host environment or user.

91
00:05:50,700 --> 00:05:58,020
OK for a simple standalone job applications a typical way to write a line of output data is system that's

92
00:05:58,050 --> 00:06:01,880
out of insulin and then inside the prentices we put our data.

93
00:06:02,220 --> 00:06:07,350
OK so this out here is an instance of the print stream class.

94
00:06:07,350 --> 00:06:08,000
Why.

95
00:06:08,010 --> 00:06:11,650
Because we called the Smurfette on this out here.

96
00:06:11,840 --> 00:06:12,220
OK.

97
00:06:12,240 --> 00:06:16,730
We can only call if it's on our objects or our classes sort this out.

98
00:06:16,730 --> 00:06:24,150
Here is is an instance of the Princeton class and inside the Princeton class we have an instance method

99
00:06:24,870 --> 00:06:26,990
that we call on this out here.

100
00:06:27,060 --> 00:06:28,010
OK.

101
00:06:28,650 --> 00:06:31,840
And that's how we can actually output some data to the console.

102
00:06:31,950 --> 00:06:35,670
So I think that's enough for this tutorial.

103
00:06:35,670 --> 00:06:39,520
If you have any questions please post the discussion in the course.

104
00:06:39,520 --> 00:06:44,160
And thanks very much for watching and I'll see you in the next tutorial.

