Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Convert Char To String

728539Oct 27 2009 — edited Oct 28 2009
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!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 25 2009
Added on Oct 27 2009
69 comments
735 views