1

00:00:01,020  -->  00:00:09,070
Let's not discuss the new Motability strings are immutable that is once a string is created its value

2

00:00:09,070  -->  00:00:10,500
can never be changed.

3

00:00:12,180  -->  00:00:19,110
For example here is one reference to a String object containing text the next year does this on a new

4

00:00:19,110  -->  00:00:25,580
String object that takes ONE TWO THREE FOUR So you know as one is not a fencing a brown you'll string

5

00:00:25,580  -->  00:00:31,000
object on the old string object containing that X AB CD remains as is.

6

00:00:31,270  -->  00:00:36,460
And we say that it is abandoned making it eligible for garbage collection which will be discussed later

7

00:00:37,860  -->  00:00:43,500
so there is really no way for us to change the contents of a string object once created.

8

00:00:43,650  -->  00:00:46,630
So there is no a method or anything like that.

9

00:00:46,950  -->  00:00:49,450
Good because we say that strings are immutable.

10

00:00:50,130  -->  00:00:51,840
So let me say strings are immutable.

11

00:00:51,960  -->  00:00:58,560
What we mean is that a string object is immutable a string reference however can be re-assign as many

12

00:00:58,560  -->  00:00:59,580
times as we want.

13

00:01:00,960  -->  00:01:07,410
In this example the string is created we are the Nuki word but it doesn't matter even if it was a strain

14

00:01:07,410  -->  00:01:08,100
when it can.

15

00:01:08,270  -->  00:01:14,730
As we know that string literal is also basically a string object so String immutability holds good even

16

00:01:14,730  -->  00:01:22,570
for critical assignments next question that you may have is why strings were made immutable.

17

00:01:23,050  -->  00:01:24,710
Let's look at a few reasons for this.

18

00:01:26,050  -->  00:01:33,180
One is bringing doning if strings are mutable then it wouldn't be possible to share string literals

19

00:01:33,180  -->  00:01:33,750
.

20

00:01:34,050  -->  00:01:40,060
For example here as one as you are referencing a string object in the string pull not say if strings

21

00:01:40,060  -->  00:01:47,440
are mutable and one ablated the string from hello to something else then it could also affect S2 and

22

00:01:47,440  -->  00:01:50,090
it would very likely lead to serious issues.

23

00:01:50,260  -->  00:01:57,840
As Esther would be expecting the value to be hello and the reason is concurrency that is multi-threading

24

00:01:58,610  -->  00:02:00,400
might be reading will be discussed later.

25

00:02:00,690  -->  00:02:05,920
But it basically allows multiple threads to perform some actions at the same time.

26

00:02:06,210  -->  00:02:09,470
Think of it as a program performing some action.

27

00:02:09,540  -->  00:02:11,690
So the problem is similar to Dunning.

28

00:02:11,880  -->  00:02:17,910
That is if a string object is mutable and the shared between multiple threads and one thread modifies

29

00:02:17,910  -->  00:02:22,640
it then the remaining would get affected without them being offered.

30

00:02:23,040  -->  00:02:30,490
So this can lead to lot of bucks one more reason is security and we know that security is very critical

31

00:02:30,490  -->  00:02:31,930
for Djala.

32

00:02:31,930  -->  00:02:34,350
There are many networking related classes in Java.

33

00:02:34,400  -->  00:02:41,560
The big strings are in book using classes with multiple strings can create serious security vulnerabilities

34

00:02:43,800  -->  00:02:50,030
for example for reading a file Java there is a class called file input stream runoff it's constrictors

35

00:02:50,030  -->  00:02:57,450
takes a file part as a string not if is used at an application fusspot forms user authentication and

36

00:02:57,450  -->  00:03:04,010
then uses this class for accessing your file but once the user has authenticated it hacker change the

37

00:03:04,010  -->  00:03:05,900
file name inappropriately.

38

00:03:05,990  -->  00:03:12,460
If strings were mutable This would allow a hacker to access a file for which he or she may not have

39

00:03:12,470  -->  00:03:18,780
permission to access So basically there is a potential for security holes if strings were notable.

40

00:03:20,000  -->  00:03:23,590
So these are just few reasons on why strings were made immutable.

41

00:03:23,630  -->  00:03:27,000
But the language designers so that's about it.

42

00:03:27,030  -->  00:03:28,680
With respect to strength immutability
