java 整數轉換成字串

2008-05-18 1:25 am
點樣先可以將一個整數轉換成字串.

回答 (1)

2008-05-18 2:05 am
✔ 最佳答案
You only have to concatenate with a String, even a null string, to convert a numeric variable such as an integer to a String.
For example, to print an integer ival,
System.out.println("The value of ival is "+ival);
or even
System.out.println(""+ival);
If you need more info, PM me.

2008-05-18 05:12:22 補充:
There is the static String function valueOf(), for example:

int number1=256;
String myString=String.valueOf(number1);


收錄日期: 2021-04-13 15:34:42
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20080517000051KK02083

檢視 Wayback Machine 備份