सीधे मुख्य सामग्री पर जाएं

#39 Why String is Immutable in Java Language ? Java में String immutable क्यों होता है ?

package com.sudhirtheindian2.java123;

public class string_immutable {
public static void main(String[] args) {

// 1 Why string is immutable in java ?

// (immutable means we can not change string)

// 2 How to change string in java ?

// 3 what is the benefit of immutable string





// 1 same object name same address so memory use minimum
// 2 program execution fast

//
String str1 = "India"; //1000
String str2 = "India1"; //1000
String str3 = "India3"; //1000
// String str = "India";

// str.concat("is great");
// System.out.println(str);









}
}

टिप्पणियाँ

इस ब्लॉग से लोकप्रिय पोस्ट