Java tutorial
public class Main { public static void main(String[] args) { String str = "java2s.com"; System.out.println(str); char[] chararr = new char[30]; str.getChars(2, 6, chararr, 0); System.out.print("Value of character array : "); System.out.println(chararr); } }