Is new string created to get length of string concatenation expression?

by Epitheoritis 32   Last Updated August 14, 2019 18:26 PM

What i would like to ask is this:

moves1="ttth";
(moves1+"t").length();

In order to measure moves1+"t" does Java create a new String object or does it calculate the 2 string lengths and adds them?

Tags : java


Related Questions


Advice on ecommerce backend with Java

Updated January 09, 2018 04:26 AM

Java: No Such File Or Directory (Using Scanner Class)

Updated November 04, 2017 02:26 AM

How does toArray(Foo[]::new) work in Java Streams?

Updated November 17, 2018 17:26 PM