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