import java.util.Scanner;
public class Main
{
public static void main (String[]args)
{
int i, j;
String name = "kamal";
char[] ab = name.toCharArray ();
String actor = "hasan";
char[] cd = actor.toCharArray ();
int l1 = ab.length;
int l2 = cd.length;
System.out.println (l1);
System.out.println (l2);
for (i =0;i <=l2;i++)
{
ab[l1 + i] = cd[i];
}
System.out.println(ab);
}
}
I am getting the output as 5,5 ArrayIndexOut of Bounds Not the output as kamalhasan
name + actor.+operator already does it. No need for all this code.