0

java dummy

what is the significance of using .toString here instead of jTF1.setText(“”+amt)

31st Mar 2019, 7:10 AM
gk.
1 Answer
+ 1
""+amt This forces Java to perform an implicit type conversion on the amount, if it is a numeric value (eg int or float) This has some performance overhead due to the JVM doing some additional function calls in the background. Integer.toString(amt) Would be explicit conversion, and besides of being more efficient, it gives the developer total control and visibility over the data type of the operands. The difference may be subtle and insignificant though, if you are only interested in the end result...
3rd Apr 2019, 6:23 AM
Tibor Santa
Tibor Santa - avatar