Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
Divya Kotamraju wrote:Hello Everyone,
Thank you all for your reply.I am new to java. I am really not knowing how to do this. Can someone let me know
"How to get individual elements of the array and concatenate with String literals and send the array to the Student constructor, not via the setter.
Thank you!!
Mohamed Sanaulla | My Blog | Author of Java 9 Cookbook | Java 11 Cookbook
You should use the + several times operator in one statement. If you use it repeatedly in different statements, or in a loop, the JVM cannot optimise the code and performance will be slow. In that case StringBuilder is a better option.Mohamed Sanaulla wrote: . . .
2. Use + operator to concatenate the elements. OR you could try using StringBuilder class for concatenating the Strings. . . .
Consider Paul's rocket mass heater. |