Answers for "java array of strings to string"

1

java collapse string array

String[] array = {"0","1","2","3","4","5","6","7","8","9"};
String s = String.join(" ", array); //<- (delimiter, target array)
Syste.out.println(s);

Output:
0 1 2 3 4 5 6 7 8 9
Posted by: Guest on June-17-2020
1

java string array to one string

public class ArrayOfStrings {
   public static void main(String args[]) {
      String stringArray[] = {"Hello ", " how", " are", " you", " welcome", " to", " Tutorialspoint"};
      StringBuffer sb = new StringBuffer();
      for(int i = 0; i < stringArray.length; i++) {
         sb.append(stringArray[i]);
      }
      String str = sb.toString();
      System.out.println(str);
   }
}
Posted by: Guest on July-17-2020
-1

list of string to string array in java

list.toArray(new String[0]);
Posted by: Guest on March-16-2021

Code answers related to "java array of strings to string"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language