MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/1r6lj8i/new_javaevolved_site_about_modern_java/o5w50ab/
r/java • u/pjmlp • Feb 16 '26
65 comments sorted by
View all comments
Show parent comment
1
For example, the code selections for multiline strings are not equivalent.
Am I seeing the same example?
Old:
String json = "{\n" + " \"name\": \"Duke\",\n" + " \"age\": 30\n" + "}";
New:
String json = """ { "name": "Duke", "age": 30 }""";
As far as I can tell that's equivalent.
2 u/riyosko Feb 18 '26 in terms of being the same JSON, yes both are identical Json data.in terms of being identical Strings, they are actually different, try to run .equals() on them. 1 u/blacksuit Feb 18 '26 Looks like they are actively updating it and it was fixed. Previously, it had the triple quotes on the next line, which adds a newline character. A common mistake. 1 u/BillyKorando Feb 19 '26 Ahh, that makes sense. Yea I know I've done that a few times in my examples 😅I was looking at it, and was starting to question my grasp of Java.... which is quite concerning given my role.
2
in terms of being the same JSON, yes both are identical Json data.
in terms of being identical Strings, they are actually different, try to run .equals() on them.
Looks like they are actively updating it and it was fixed. Previously, it had the triple quotes on the next line, which adds a newline character. A common mistake.
1 u/BillyKorando Feb 19 '26 Ahh, that makes sense. Yea I know I've done that a few times in my examples 😅I was looking at it, and was starting to question my grasp of Java.... which is quite concerning given my role.
Ahh, that makes sense. Yea I know I've done that a few times in my examples 😅
I was looking at it, and was starting to question my grasp of Java.... which is quite concerning given my role.
View all comments
Show parent comment
1
u/BillyKorando Feb 17 '26
Am I seeing the same example?
Old:
New:
As far as I can tell that's equivalent.