1 2 3 Previous Next 69 Replies Latest reply: Oct 27, 2009 4:48 PM by 843789 RSS

    Convert Char To String

      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;
      public String getGebder()
              if (gender == 'm' || gender == 'M')
                   return "Male";
              else if (gender == 'f' || gender == 'F')
                   return "Female";
                   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!
        1 2 3 Previous Next