1

00:00:01,140  -->  00:00:08,510
Let's begin by looking at Dodik matters which very briefly discussed when introducing methods well into

2

00:00:08,520  -->  00:00:11,680
using methods these methods can be of two types.

3

00:00:11,700  -->  00:00:12,090
One is.

4

00:00:12,090  -->  00:00:15,390
Instance Well the other is static doorways.

5

00:00:15,420  -->  00:00:16,670
Object oriented.

6

00:00:16,820  -->  00:00:20,750
And so most of the time methods invoke Bill which state that is.

7

00:00:20,760  -->  00:00:27,750
Instance variables such methods are the instance matters but sometimes we also implement utility methods

8

00:00:28,140  -->  00:00:33,150
that do not depend on state on such matters are defined as tactic.

9

00:00:33,180  -->  00:00:39,130
An example would be the min method from the class Jawa Dr. Lang dogmatic which is a class that provides

10

00:00:39,210  -->  00:00:43,520
several utility methods for performing mathematical operations.

11

00:00:43,920  -->  00:00:52,440
Not that a class can how only instance are only static methods or it can how both of them started motets

12

00:00:52,450  -->  00:00:55,550
have the keyword static in them at their declaration.

13

00:00:55,650  -->  00:01:00,120
Absence of static the word implies it's an instance method.

14

00:01:00,120  -->  00:01:02,900
Main method is an example of a static method.

15

00:01:02,940  -->  00:01:08,010
In fact all the matters to be brought so far in our BASIX democracy are static matters.

16

00:01:09,000  -->  00:01:10,750
Startlement that's a plasma.

17

00:01:10,980  -->  00:01:17,230
There there is as I mentioned earlier unlike instance methods they don't build with objects.

18

00:01:17,460  -->  00:01:23,280
That is they don't have access to either instance variables or instance methods trying to access them

19

00:01:23,280  -->  00:01:26,980
from a static method generates a compiler.

20

00:01:27,660  -->  00:01:34,790
However they can access static variables if you recall static rebels or class global variables.

21

00:01:34,920  -->  00:01:41,040
That is they are also not object specific a static variable declared in a class is shared across all

22

00:01:41,040  -->  00:01:43,060
objects of that class.

23

00:01:44,040  -->  00:01:47,060
Since started methods don't have anything to do with it.

24

00:01:47,100  -->  00:01:54,210
They can be accessed other static methods in the same class since they are plausible amateurs.

25

00:01:54,390  -->  00:02:00,510
They can be invoked using a dart operator on the class name for example invalid Amendment.

26

00:02:00,630  -->  00:02:01,880
In the math class.

27

00:02:01,980  -->  00:02:08,790
You will simply do math Trotman and it would also save heaps because as you don't have to create an

28

00:02:08,790  -->  00:02:14,610
object laundered it is legal to invoke a static method on a reference variable.

29

00:02:15,000  -->  00:02:20,560
But it leads to misleading code as reference variables are associated with objects.

30

00:02:20,760  -->  00:02:24,940
So it's not recommended to invoke a static method using a reference variable.

31

00:02:25,170  -->  00:02:33,470
And even if you do compiler would implicitly resolve it back to class name next is an effective item

32

00:02:33,610  -->  00:02:40,180
and it has item for under-dressed enforce non intangibility with a private constructor.

33

00:02:40,890  -->  00:02:46,050
Basically if all methods in your class will be static then you can make the class non-instructional

34

00:02:46,560  -->  00:02:48,980
by marking its constructor as by weight.

35

00:02:49,380  -->  00:02:54,890
So if you make the concept of by private that no other code can create an object of your class.

36

00:02:55,220  -->  00:03:00,980
And that would also save some heaps because dollar not Langbroek Matt is implemented this way.

37

00:03:01,470  -->  00:03:06,070
Which means that we cannot create an instance of the math class.

38

00:03:06,090  -->  00:03:11,280
Let's actually look at this by revealing the source code of the math class.

39

00:03:12,230  -->  00:03:19,650
Then what I want to explore source code I use this site called a core I simply google for grep or under

40

00:03:19,640  -->  00:03:21,970
a particular class I want to explore.

41

00:03:22,320  -->  00:03:23,310
So let's do that.

42

00:03:23,370  -->  00:03:27,470
So let's search her grep code under map class.

43

00:03:27,690  -->  00:03:30,490
Let's just type in math here.

44

00:03:30,960  -->  00:03:34,440
So this is the fosterling listeners just click dot.

45

00:03:35,010  -->  00:03:39,010
And here it shows the code for my class.

46

00:03:39,090  -->  00:03:46,740
So basically grep God is a search engine that has in several libraries including JDK and it basically

47

00:03:46,740  -->  00:03:54,330
allows us to browse through these libraries for JDK they index something called Open Jilek which is

48

00:03:54,330  -->  00:04:00,130
an open source version of Judy and it is almost identical to articles JDK.

49

00:04:00,330  -->  00:04:04,080
So you should be able to explore this code without any assumptions.

50

00:04:04,500  -->  00:04:07,070
So let's just look at this math class that we have here.

51

00:04:07,080  -->  00:04:13,890
So it's the actual source code and here it says open Judy key and it's one of this I think it's one

52

00:04:13,890  -->  00:04:19,390
of the six point oceans jealous ex Mercians but that's fine.

53

00:04:19,860  -->  00:04:21,990
And let's click on this.

54

00:04:21,980  -->  00:04:28,520
This is the constructor here you can see the constructor and all the methods in the math class.

55

00:04:28,860  -->  00:04:29,130
OK.

56

00:04:29,130  -->  00:04:31,640
So let's just click on this.

57

00:04:31,680  -->  00:04:37,440
Here is the constructor and it says it has a pirate modifier which means that it is non instantiation

58

00:04:37,440  -->  00:04:38,010
.

59

00:04:38,010  -->  00:04:39,100
Right.

60

00:04:39,200  -->  00:04:42,170
And here are all the different methods that we have.

61

00:04:42,720  -->  00:04:44,780
And here is one of them at the men.

62

00:04:44,790  -->  00:04:46,420
Let's just go ahead and click that.

63

00:04:46,620  -->  00:04:54,140
It's an overloaded method and here as this tactic modifier which means that it is a static method.

64

00:04:54,420  -->  00:05:02,770
And as we know all the materials in the math class are static metrics and if you click despondence and

65

00:05:02,780  -->  00:05:10,810
don't idle it shows as all the usages all the classes that are using this particular mean matter.

66

00:05:10,830  -->  00:05:17,380
For example string class is using the amendment from this particular matter called compared to.

67

00:05:17,730  -->  00:05:24,950
And here is how another class called Jawad or RSA which is also using it in a medical sort.

68

00:05:24,960  -->  00:05:29,000
One is is also like math class.

69

00:05:29,060  -->  00:05:31,490
It has a private constructor.

70

00:05:31,620  -->  00:05:34,480
So it is also a non intangible.

71

00:05:35,040  -->  00:05:37,570
And these are some other amateurs.

72

00:05:37,710  -->  00:05:44,610
Some other classes that are using them in matter and that's supported regarding the Gruppe so you can

73

00:05:44,610  -->  00:05:52,830
use it to explore any particular classes that you want to explore and you can also do one more thing

74

00:05:52,860  -->  00:05:54,970
if you don't want to use this.

75

00:05:55,110  -->  00:06:00,460
You can actually search I mean to adjudicate that you don't order it also comes with the sourcecode

76

00:06:00,600  -->  00:06:01,280
.

77

00:06:01,290  -->  00:06:04,110
So let me just short you on my machine.

78

00:06:04,110  -->  00:06:09,590
So this is the root directory of my JDK which is the day to get one point eight.

79

00:06:09,600  -->  00:06:16,590
So I just went into program files Java JDK 1.8 and here you can see this zip file called SIAC and it

80

00:06:16,590  -->  00:06:18,500
has the source code.

81

00:06:18,510  -->  00:06:20,230
So you just need to unzip it.

82

00:06:20,500  -->  00:06:27,540
I have also done that and I just extracted only one of the directories which is Jawa it has a few others

83

00:06:27,540  -->  00:06:27,630
.

84

00:06:27,690  -->  00:06:32,340
The zip file has a few other directories but I just exported only one of them.

85

00:06:32,340  -->  00:06:34,380
So here it is the Jawa.

86

00:06:34,380  -->  00:06:36,150
So you're going to Jawa.

87

00:06:36,210  -->  00:06:38,100
So these are the different folders.

88

00:06:38,200  -->  00:06:41,280
Like the job line or two line packages here.

89

00:06:41,280  -->  00:06:42,530
So just going to lying.

90

00:06:42,810  -->  00:06:49,350
And then you can see all the glasses here.

91

00:06:49,380  -->  00:06:58,440
Here is my door Jawa and I can just edited and it's the same thing.

92

00:06:58,470  -->  00:07:06,670
I can explode the code so you can either do this or you can explore the grep go to that site.

93

00:07:07,620  -->  00:07:09,550
And that's about it.
