Hi friends,
I have defined one class
public class UserRegistration {
String first_name = null;
String last_name = null;
String dobd = null;
String dobm = null;
String doby = null;
String gender = null;
String occupation = null;
String marital_status = null;
public String getFirst_name()
{
return this.first_name;
}
public String getLast_name()
{
return this.last_name;
}
public String getDobd()
{
return this.dobd;
}
public String getDobm()
{
return this.dobm;
}
public String getDoby()
{
return this.doby;
}
..................
....................
}
and I have instantiated this class in a different class but so far I can access fields of UserRegistration class like this way
UserRegistration object = new UserRegistration();
String str = object.first_name;
It shows that I cant use this object as an aaray like
String str = object[0] ;
My intention is to use this UserRegistration's
object as an array so that I can iterate through its fields using a loop not by using its fields name and a dot operator manually.
How to convert this
object to and
String array?