OCJA(1Z0 - 808)|| Important Conclusions about String Immutability

preview_player
Показать описание
Java tutorial by durga sir

Java 9 by durga sir

Java 1.8 Version New Features by Durga sir

Adv Java JDBC Tutorial by Durga sir

OCJA 1.8 Java SE 8 Programmer - I (1Z0 - 808 ) By Durga sir

Core Java by NagoorBabu sir

Advenced Java by Nagoorbabu sir

CoreJava by Ratan

Advanced Java jdbc by Ratan

Advjava tutorials - JSP by Ratan

Adv java servlets tutorial by ratan

Servlet and JSP Tutorial by anji reddy

Advanced Java Jdbc by Anjireddy

Hibernate byAnjireddy

Struts by Anjireddy

Spring by Mr.AnjiReddy

ADV JAVA by Naveen

Spring by Mr.Naveen

Hibernate by Mr. Naveen

Struts by Mr.Naveen
Рекомендации по теме
Комментарии
Автор

Sir, this big concept got know after many years! thanks a lot!

muninkumbhakar
Автор

Sir in last example As For DURGA is a string constant so in SCP also object copy created

shubhamgaygol
Автор

my doubt is, when you create String s2 = s1.lowerCase();

why it doesn't point to the object in SCP but it points to the object in Heap despite both are the same valued object.
isn't SCP supposed to be searched first by JVM ?

please explain Sir

Respect from Canada.

Anonymous-shkc
Автор

Thanks for sharing. I just have 1 question in regards to the s1.toUpperCase() statement. Any new object that gets created during runtime, goes into heap area. However once any new string that gets created in heap, the same gets created in string constant pool too. If my understanding is correct, then once "DURGA" gets created in heap, will "DURGA" get created in SCP too??
Please correct me if I am wrong..

premabhisek
Автор

Why does s3 point to durga String in Heap area and not SCP area? Anyone? 7:01 timestamp

raghipandit
Автор

String s1 = new String("durga");
String s2 = s1.toUpperCase();

String s3 = s2.toLowerCase();

System.out.println(s1==s2);

System.out.println(s1==s3);

what will happen in this case??? please explain.

dilipgyawali
Автор

private void doubt() {
String s1= new String ("you cannot change me");
String s2 = "you cannot";
String s3 = s2+"change me";

//case1
// sir first new key word s1 object create in heap area and scp area
//s3 = "you cannot change me" create in run time it not pointing into s1 heap area object but same content
String s4 = new String("durga");
String s5 = s4.toLowerCase();

//case2
//sir s4 object is create in two area heap and scp area ok
// s5 = s4.toLowerCase();this is run time operation ok because of that object is create in heap area
// s5 is pointing into s4 because of same content you said that in case1 s1 content and s3 content is also same then
//why it not pointing into same object why i got false in answer

krishnamoorthi