We are not done with the language basic series. 2
And with that we have set a solid foundation towards mastering Djala. 3
We mastered all the essentials in the process. 4
We also learned about Ben Arcel effective July dance. 5
Next we will learn more serious object oriented programming and concepts like inheritance polymorphism 6
abstract classes and interfaces that we will how all the tools to write some awesome object oriented 7
programs. 8
Let's not look at some of the topics we covered in this chapter. 9
We started with startlement the 10 variables we next looked at final variables within a box primitives 10
an auto boxing. 11
Finally we did several coding conventions. 12
So let's go ahead and look at some of the important points we covered in this chapter. 13
First a static method. 14
Static methods are simply class methods. 15
Are basically utility methods that do not depend on state. 16
That is the instance variables are an instance methods they can access only static syllables and other 17
static matters. 18
If your class has only static methods then you can make the class non intangible by marking its concept 19
class by weight. 20
Next we'll discuss tactic was ecstatic methodes stopped equatable class variables that is shared across 21
different objects of ductus. 22
So there are not an instance variables which are unique to each object and with regards to accessibility 23
they're accessible from static methods but they're also shared across objects of the class which means 24
that they're also accessible from instance methods as well as constructors Mexoryl is because finally 25
variables the term final simply implies that something cannot be changed. 26
That is it is final. 27
So if a variables value should be final that is it shouldn't change once initialized then it needs to 28
be my best final So finally reliable. 29
Basically in place constant if it is used with a primitive variable then the value can never be changed 30
. 31
But recall that if it is used with reference variable then the reference is constant. 32
That is a reference all response to the object initialized it and cannot be reassigned another object 33
Hello contents of that object can be changed. 34
So you should keep that in mind. 35
Find out what it was. 36
Do not get a default value. 37
And the reason for that is a final variable gets a default value and is initialized once again. 38
Let's say in a constructor then we are violating its coater definition on final keyword can be used 39
with any of the three kinds of variables. 40
That is instance local are started as part of final variables. 41
We also discussed about constant variables which are a kind of final variables whose values are known 42
at compile time itself. 43
For this reason they're usually also referred to as compile time constants. 44
And here is an example which is a variable Pi from the math class. 45
Compile time constants below compilers to perform some optimization. 46
For example here we have variable x which is assigned my doc by. 47
But my point is a compile time constant and the compiler knows the corresponding value 3.1 for citizens 48
3.1 for directly to the variable x unstarted in the class file as part of the bytecode. 49
So this element of some overhead at runtime as JVM doesn't have to look into math class to make this 50
assignment. 51
So compiler is able to perform such an optimization and here are some restrictions for a final really 52
. 53
But to be qualified as a constant variable first is obviously it needs to be declared with the modifier 54
final. 55
Next a deadlock type of variable should be either a pyramidal or a string. 56
If you have any other data type then it will not be a constant variable. 57
So that's a very important point to remember. 58
Next variable must be initialized in the declaration statement itself. 59
That is it cannot be initialized somewhere else like in a constructor or in some initializer block. 60
Finally the initialization expression itself must be a constant expression a constant expression is 61
something whose value is known at compile time itself and hence it is also referred to as compile time 62
constant expression. 63
There are some rules on what expressions qualify as constant expressions but typically you would see 64
either put them a Dolittle's or string literals as constant expressions like in the case of mad dark 65
by next that box primitives and then a related topic called auto boxing auto boxing which was introduced 66
in Jollof I blurred the distinction between put him into Dave's unboxed promotors for example baulks 67
primitives could be directly assigned primitives on similarly primitives could be directly assigned 68
baulks primitives. 69
Also the art of boxing images could be directly added good data structures like orderless and this. 70
How about introducing what city hall or one of the effect of their lifetimes. 71
Cautions that there are some issues that we met on indu. 72
If box primitives are used carelessly we discuss the issues and how also tried them out in gold. 73
Finally we look at coding conventions which are critical for writing clean and professional good. 74
The first look that naming conventions onwards goes pretty much all the recommendations that are suggested 75
by I am 56 mid-strength on sticking to generally accepted naming conventions rediscuss but typographical 76
ungrammatical naming recommendations on Risher try to follow them as much as we can. 77
Next we'll have the conventions for how to structure our programs. 78
We said when designing our classes they should follow the single responsibility principle which simply 79
means that the class should have only one responsibility. 80
This would also limit the class size and more importantly would help us create better abstractions. 81
That is how loosley couple classes next with regards to amateurs. 82
We should try to keep them very small unfocussed they should do only one thing no more. 83
We are told that one recommendation from Effective Java whose suggestion was to minimize the scope of 84
local variables. 85
The item recommenced or declare a local library but there it is fussiest. 86
It also recommends to use for loops and sort of bli loaves as frontal lobes are better at minimizing 87
the scope of variables and help in preventing bucks. 88
Finally we look at some conventions for writing comments generally common should provide overuse of 89
code. 90
It is perfectly fine to describe any non-obvious design decisions but do white writing frequent comments 91
under-fire being compelled to write frequent comments. 92
Then it means you may want to consider the factoring some of the stuff usually just good descriptive 93
method and variable names undoctored so of us documentation. 94
And that's about it. 95
We have set all the necessary foundations that we need and we can no more want a more advanced off. 96
Thanks for listening and I will see you in the next chapter