2
How do I convert the Integer to String type in Java?
The variable matricula
is declared as whole, but to show it on the screen it asks to convert it to String.
txtmatricula.setText(txtmat.getMatricula()));
2
How do I convert the Integer to String type in Java?
The variable matricula
is declared as whole, but to show it on the screen it asks to convert it to String.
txtmatricula.setText(txtmat.getMatricula()));
3
Use String.valueOf()
String matriculaString = String.valueOf(txtmat.getMatricula())
txtmatricula.setText(matriculaString);
Perks
valueOf()
cacheia numbers frenquently used from -127 to 128;Integer.toString()
, which leaves the number representation in String, consistent;Source in English: https://www.java67.com/2012/10/best-way-to-convert-numbers-to-string-in-java-example.html
Browser other questions tagged java string int parse
You are not signed in. Login or sign up in order to post.
Integer.toString(txtmat.getMatricula());
– Augusto Vasques
@Augustovasques thank you
– mramires56
txtmat.getMatricula() + "";
– Costamilam