hello to all,
public class Person { protected String name; protected String gender; protected int dateOfBirth; protected String address; protected String natInsceNo; protected String phoneNo; protected static int counter;//class variable public Person(String nme,String addr, char sex, int howOld, String ins,String phone) { dateOfBirth = howOld; gender = sex; name = nme; address = addr; natInsceNo = ins; phoneNo = phone; counter++; } public String getGebder() { if (gender == 'm' || gender == 'M') return "Male"; else if (gender == 'f' || gender == 'F') return "Female"; else return "Wrong Input"; }
on this code, the user insert a char and the programs returns a String
could you please tell how to make the conversion?
thank you in advanced!
the user has to enter a CHAR and get a STRING
the error is :Incompatible operand types String and char
Multiple markers at lines
line 30 - Incompatible operand types String and char
line 32 - Incompatible operand types String and char
this is how the eclipse report the errors!