filmov
tv
Java interview questions 2 for freshers. Why String in Java is Immutable #shorts #coding #interview

Показать описание
Java interview question 2
Why String in java is immutable
String variable can be changed to point at any object but the string object itself is immutable in java.
In this example the name = “salow” and another_name is also = “salow”
So string salow is created once in the string pool and both the variables point towards the string.
When java creates a string object it stores in a string pool, whenever a string is created java will check if the string is available in the string pool.
If it is not available in string pool it will create the literal in String Pool and point to it.
String pool is a place where all the literals of string are stored and this requires string to be immutable or else the shared reference can be changed from anywhere.
The next main reason is due to security in java makes string immutable hence no one can change reference of string once created.
Using Visual Studio Code editor
#shorts #JavaDevelopment #Coding #Java #tutorial #VSCode #freshers #2021
Why String in java is immutable
String variable can be changed to point at any object but the string object itself is immutable in java.
In this example the name = “salow” and another_name is also = “salow”
So string salow is created once in the string pool and both the variables point towards the string.
When java creates a string object it stores in a string pool, whenever a string is created java will check if the string is available in the string pool.
If it is not available in string pool it will create the literal in String Pool and point to it.
String pool is a place where all the literals of string are stored and this requires string to be immutable or else the shared reference can be changed from anywhere.
The next main reason is due to security in java makes string immutable hence no one can change reference of string once created.
Using Visual Studio Code editor
#shorts #JavaDevelopment #Coding #Java #tutorial #VSCode #freshers #2021
Java Development Mock Interview | Part 2 | Interview Questions for Java Developers
TechM round 2 java interview questions and answers | Microservices interview questions
Top Core Java Interview Questions || Core Java Interview Questions and Answers [MOST ASKED]
Java Interview Questions And Answers | Java Programming Interview Questions And Answers |Simplilearn
20 Basic Core Java Interview Questions & Answers- TCS, Accenture, Cognizant, Infosys, Wipro, HCL
Java 8 Coding Interview | L2 Capgemini Java Interview
Java Interview Preparation for 2 Years Experienced | java Coding interview questions
JPMorgan java interview experience round 2 || interview questions and answers, Microservices, 5 year
Automation Testing Interview Questions and Answers #selenium #corejava #automationtester #software
JP MORGAN interview questions for Java Advanced Developers
Cognizant Java Spring Boot Interview | Java Interview Questions & Answers
TCS Java Coding Interview 2 years Experience | Mock Java Coding Interview
Java interview questions for Freshers - Part 2
Real time Java Interview Questions for 4 years Experienced
JAVA Interview Questions & Answers 12/Java Very important interview Questions & Answers/Java
Watch this !! If you are applying with 2.5 years | Java interview | Spring boot | hibernate
Cognizant Java Coding Interview | Second Round | Java Developer Interview
Core Java, Spring Boot, Microservice Interview Questions | Cognizant L1 Technical Interview
Top Tricky Java Interview Questions and Answers | Java Interview Questions and Answers | Code Decode
Java Interview Question | Java Mock Interview 2023 | By Kiran Sir
How to prepare Java interview for Experienced
Java Interview Questions | Macbook Contest
TCS Java Coding Interview | Use this simple method to solve any Java Problem | Selected
Java collections framework interview questions and Answers | MOST ASKED | Core Java | Code Decode
Комментарии