i have this program...the color program..but i have a problem on converting a string to character. anybody can help me..thanks..
below is the java code
import javax.swing.JOptionPane;
public class ab{
public static void main(String[]args){
String a;
a=JOptionPane.showInputDialog("Enter color: ");
// I need to convert the variable a from string to character since condition below
//deals with a character..a is declared as a character since jOptionpane above
// accepts string.Or, do i lack some necessary header files in order to convert a
//string to character...thanks
if ((a=='r')||(a=='R'))
JOptionPane.showMessageDialog(null,"RED");
else if((a=='r')||(a=='B'))
JOptionPane.showMessageDialog(null,"Blue");
else
JOptionPane.showMessageDialog(null,"Invalid Input");
}
}