object Scala_String {
def main(args: Array[String]): Unit = {
// Character array with data.
val arr_num = Array('1', '2', '3', '4', '5', '6');
// Create a String containig the contents of arr_num
// starting at index 1 for length 2.
val str = String.copyValueOf(arr_num, 2, 3);
// Display the results of the new String.
println("\nThe book contains " + str + " pages.\n");
}
}
Sample Output:
need an explanation for this answer? contact us directly to get an explanation for this answer