Java Interview Question for Automation Tester - Strings are Immutable
Автор: Lets Learn QA
Загружено: 2026-01-07
Просмотров: 77
Java Interview Question for Automation Tester - Strings are Immutable
String are immutable in Java.
Means once a String is created, it value can not be changed.
Why Strings are Immutable in Java
-------------------------------
1) Security Use Case
String token= "qwerty123"
If token were mutable → one method could corrupt it → all APIs start failing.
2) Memory Optimization
String s1 = "Selenium";
String s2 = "Selenium";
Because String is immutable:
Both s1 and s2 point to the same memory
Saves memory when same values repeat
3) Thread Safe
String baseUrl = "https://qa.myapp.com";
Multiple threads use this value:
Thread 1 → Login Test
Thread 2 → Order Test
Thread 3 → Payment Test
Because String is immutable:
No thread can change baseUrl
No synchronization needed
Parallel testing will be easier.
#interviewquestionsjava #automationinterviewquesions
#seleniumjava #automationtesting #interviewpreparation #interviewquestions #seleniumtraining #letslearnqa #strings #stringsimmutable
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: