mardi 4 août 2015

How to pass string values to Method accepting Object array of another class

From HTML form i am collecting string values as follows..

String name=request.getParameter("name").trim();
String addr=request.getParameter("addr").trim();
long money=Long.parseLong(request.getParameter("money").trim());

and I want to pass these values to method createAccount(CreateAccountField[] field) but it is showing me error that

Type mismatch: cannot convert from String to CreateAccountField

I tried converting String to Object class object and then to CreateAccountField, but as String is immutable, we can not assign it to another class object. how can I solve this?

Aucun commentaire:

Enregistrer un commentaire