Answers for "how to use charat in string array in java"

2

java put a char array into a string

char[] arr = { 'p'," ",'q', 'r', 's' };
      String str = String.valueOf(arr);
      System.out.println(str);//"p qrs"
Posted by: Guest on March-20-2020
0

char array substring java

Try the String(char[], int, int) constructor:

String s = new String(a, 2, 4);
That will construct a String from the characters of array a starting at offset 2 and a length of 4.
Posted by: Guest on December-12-2021

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language