java string copy characters

Java
public class Demo {
   public static void main(String []args) {
      char[] arr = { 'p', 'q', 'r', 's' };
      String str = String.copyValueOf(arr, 1, 2);
      System.out.println(str);
   }
}
Source

Also in Java: