Tuesday, January 1, 2019

java - How to merge contents of an array?





For example, If I have an array



String[] myStringArray = new String[]{"x", "a", "r", "y"};


How do I make a singular string that is "xary"


Answer



String[] myStringArray = new String[]{"x", "a", "r", "y"};
StringBuilder builder = new StringBuilder();
for(String s:myStringArray)

builder.append(s);

System.out.println(builder );

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...