
π Day 30 of My Automation Journey β Strings in Java - part 1
π§΅ What is String in Java? If you are just starting with Java, one of the most important things youβll learn is String . Donβt worry β weβll explain this in a very simple way so that even a 10th-grade student can understand π π 1. Introduction β What is a String? π A String in Java is simply a sequence of characters . Example: String name = "Bala" ; Here: "Bala" is a String It contains characters: B, a, l, a π§ Real-Life Example Think of a String like: Your name β "Ravi" A sentence β "I love Java" A password β "abc123" π Anything inside double quotes (" ") is a String in Java. ποΈ 2. How String Came into Java (Origin) Java was created to be: Secure π Simple β¨ Reliable πͺ So, the designers of Java made Strings: β Immutable (Very Important Concept) π Once created, a String cannot be changed Why? Security (no one can modify passwords, URLs) Performance (reuse of same String) Thread safety (safe in multi-threading) π§± 3. How String is Stored in Memory There are two ways Strings are created: πΉ M
Continue reading on Dev.to
Opens in a new tab



