I believe that your problem is this:
String s1 = new String( secondLength );
....
lastName.getChars ( 0, 5, secondLength, 0 );
When you create the "s1" the "secondLength" array is empty. Then you call the method that gives to the array values, but the s1 was already created.
Try first to enter values to the array and then create the String "s1".
Also try to print the result at a System.out.println :
String finalResult = firstName.charAt(0) + s1 + number;
System.out.println("Final Result :"+finalResult);
Reputation Points: 1014
Solved Threads: 447
Nearly a Senior Poster
Offline 3,260 posts
since Dec 2007