1

00:00:01,030  -->  00:00:05,910
We are not done with the chapter and we're not left with only one more chapter to color in the language

2

00:00:05,910  -->  00:00:07,140
basic series.

3

00:00:07,590  -->  00:00:10,140
So let's see what we call it in this chapter.

4

00:00:10,140  -->  00:00:17,700
We started with the Djala API and then the process introduced package's Villa get hope classes insight

5

00:00:17,740  -->  00:00:19,300
packages can be accessed.

6

00:00:20,020  -->  00:00:27,250
We also look at how we can create packages are sort of on also how we can name packages next believe

7

00:00:27,270  -->  00:00:32,920
that one of the most fundamental concepts in Java which is string and we've discussed it extensively

8

00:00:34,600  -->  00:00:41,080
next we'll have get access levels which aid in implementing information hiding information hiding is

9

00:00:41,080  -->  00:00:47,330
critical for that will happen loosely coupled software components so let's go ahead and look at some

10

00:00:47,330  -->  00:00:54,620
of the important points covered in this chapter after introducing what packages are being discussed

11

00:00:54,620  -->  00:00:57,700
on how classes and packages can be accessed.

12

00:00:58,900  -->  00:01:02,930
You can use an import statement to Access classes in a package.

13

00:01:04,410  -->  00:01:10,690
And to import multiple classes in the same package we can either import them separately or we can import

14

00:01:10,690  -->  00:01:17,050
them all at once using a star import importing them separately seemed to be a generally preferred solution

15

00:01:17,060  -->  00:01:17,280
.

16

00:01:19,110  -->  00:01:22,490
Not that important process does not make our process bigger.

17

00:01:23,680  -->  00:01:27,040
And they also have no effect on that runtime performance.

18

00:01:27,900  -->  00:01:35,850
It just saves us from typing the fully qualified names finally Djala not lying back baggage is always

19

00:01:35,850  -->  00:01:44,460
important by default next report or class in a package we need to first ensure that there is a matching

20

00:01:44,460  -->  00:01:49,910
directory structure on the file system and the class needs to be in the last directory.

21

00:01:50,940  -->  00:01:57,180
The second step is to put a package statement at the top of the class that is it needs to be even before

22

00:01:57,180  -->  00:02:05,550
any import statements next for an example we saw an issue that we may face to package naming conflict

23

00:02:05,550  -->  00:02:06,260
.

24

00:02:06,360  -->  00:02:12,330
So we said the recommended convention is to use the organization's rulers Internet domain name.

25

00:02:12,510  -->  00:02:20,500
We also discuss few recommended package naming conventions next me look at strings a stringing is simply

26

00:02:20,500  -->  00:02:28,380
an object of the class dollar that land docstring a string object in Djala is immutable that is once

27

00:02:28,380  -->  00:02:32,410
a string object is created its value can never be changed.

28

00:02:32,440  -->  00:02:34,970
So you're talking about String object here.

29

00:02:34,990  -->  00:02:42,170
How would the variable referencing a string object can be reassigned a different string object that

30

00:02:42,230  -->  00:02:48,870
in dentally string class you use a psychotic diary to start the next MVNO characters are internally

31

00:02:48,870  -->  00:02:55,310
represented using you give 16 encoding scheme which is an implementation of Unicode characters.

32

00:02:56,610  -->  00:03:05,120
See a string object basically contains an immutable sequence of Unicode characters next me look at how

33

00:03:05,120  -->  00:03:12,420
strongly girls are starting dentally by looking at string bull Gibeon physicalist or stringless close

34

00:03:12,730  -->  00:03:20,930
as String objects on the string will unstring recites on the heap see String objects created from string

35

00:03:20,930  -->  00:03:27,120
literals are stored on the string ball like String objects created via an Nuki word get stored outside

36

00:03:27,160  -->  00:03:28,220
of the string ball.

37

00:03:28,480  -->  00:03:35,660
But still on the heap like any regular job object but the cool thing is that even if there are multiple

38

00:03:35,660  -->  00:03:41,630
string literals that the same content they will share the same stone age on the string pool that is

39

00:03:41,630  -->  00:03:43,710
only one string object is created.

40

00:03:43,880  -->  00:03:51,160
So that saves us memory and this process of building up the string pool is referred to as bringing turning

41

00:03:52,000  -->  00:03:59,690
on each object on the string ball is referred to as a string in turn are simply in indent next string

42

00:03:59,690  -->  00:04:05,760
concatenation and it can be done using a blitz operator or a string builder or a string buffer Well

43

00:04:05,950  -->  00:04:07,650
string class is immutable.

44

00:04:07,730  -->  00:04:13,910
String builder and string buffer allow us to mutate strings that is these classes allow their contents

45

00:04:13,910  -->  00:04:15,020
to be changed.

46

00:04:16,360  -->  00:04:22,420
Because that according to one benchmark string builder was found to be 300 pounds faster then plus operator

47

00:04:23,600  -->  00:04:31,500
an twice as fast us string buffer and we also review of this effective delightsome which says beware

48

00:04:31,510  -->  00:04:33,990
the performance of string concatenation.

49

00:04:34,270  -->  00:04:36,980
It's main recommendation was to use string builder.

50

00:04:37,060  -->  00:04:44,010
If performance is important and to use plus operator or need to combine few strings so if you're constructing

51

00:04:44,010  -->  00:04:52,040
a large string then you should go heartstring builder next will get access liver's which was all about

52

00:04:52,040  -->  00:04:56,140
providing restrictions on accessing classes under remembers.

53

00:04:56,160  -->  00:05:02,540
Here are the four access levels and the corresponding access modifiers second and fourth access Lobo's

54

00:05:02,780  -->  00:05:08,830
that is different on public are common classes on interfaces Un-Dead members.

55

00:05:08,930  -->  00:05:14,660
When the first and third access modifiers that is private and protected are unique to only class members

56

00:05:14,840  -->  00:05:21,490
like bills and methods so here it means the class member is private first class.

57

00:05:21,750  -->  00:05:25,340
That is it is inaccessible to code outside of its class.

58

00:05:26,150  -->  00:05:33,300
Next is default that is options of access Mordy fair it implies a class member accessibility is only

59

00:05:33,300  -->  00:05:35,400
d'accord within the same package.

60

00:05:36,510  -->  00:05:43,510
Next is protected which implies a class member is accessible to any code within the same package and

61

00:05:43,510  -->  00:05:46,820
also put any of the subclasses of its class.

62

00:05:46,810  -->  00:05:53,300
Some classes will be introduced when we get to inheritance finally the modified public is used when

63

00:05:53,420  -->  00:06:00,800
accessibility is to any code within the package or any code outside of the package not that anything

64

00:06:00,800  -->  00:06:08,360
declared with public welfare will be part of the API of these modifiers private and public use most

65

00:06:08,360  -->  00:06:17,000
of the time finally have information hiding it helps in building value design software which comprises

66

00:06:17,000  -->  00:06:24,810
often loosely coupled components and it is achieved by using access modifiers it fundamental rule of

67

00:06:24,930  -->  00:06:32,010
information hiding is to never expose your instance fields with public access level as it leads to bite

68

00:06:32,010  -->  00:06:33,300
coupling.

69

00:06:33,300  -->  00:06:41,000
Make instance friends private and provide access to them be setters and getters general seditionist

70

00:06:41,330  -->  00:06:46,310
as much as possible minimize accessibility to classes their members.

71

00:06:47,170  -->  00:06:53,690
So we looked at two very important effective July dumps that are related to information hiding and that's

72

00:06:53,690  -->  00:06:54,650
about it.

73

00:06:54,650  -->  00:06:59,720
Thanks for listening and we will continue learning more language basics in the next chapter.

74

00:06:59,720  -->  00:07:01,500
So see you in the next chapter
