Saturday, 14 December 2019

java - How string concat method works

I know String in Java is immutable. Consider:



String s = "Java";
s = s.concat(" is simple");
System.out.println(s); //prints Java is simple


Here the value of String s is changed? Can someone explain me, how String concat actually works?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print ...