Hey everyone, I am having a problem with converting my character array. The program runs, but in the display box I get little squares instead of a string. The program should display the first char of the fist name, the first five of the second name and a random number between 10-99. Thanks much for your help.
import java.util.Random;
import java.util.Scanner;
import javax.swing.JOptionPane;
public class Check {
/**
* @param args
*/
public static void main(String[] args)
{
Scanner input = new Scanner ( System.in); // creates an object of scanner
Random random = new Random (); // creates an object of random
char secondLength[]= new char [5]; // array for five characters
int number = 0; // variable for number generated
String s1 = new String( secondLength );
//random number generator ranging from 10-99
number = 10 + random.nextInt ( 90 );
// gather data from user
String firstName = JOptionPane.showInputDialog( "Enter first name" );
String lastName = JOptionPane.showInputDialog( "Enter last name" );
lastName.getChars ( 0, 5, secondLength, 0 );
System.out.print( number );
JOptionPane.showMessageDialog
( null, "Your new string is: " + firstName.charAt(0) + s1 + number );
}
}