static String toString(short s)
描述 (Description)
java.lang.Short.toString(short s)方法返回一个表示指定short的新String对象。 假设基数为10。
声明 (Declaration)
以下是java.lang.Short.toString()方法的声明
public static String toString(short s)
参数 (Parameters)
s - 这是要转换的短片。
返回值 (Return Value)
此方法返回指定short的字符串表示形式。
异常 (Exception)
NA
例子 (Example)
以下示例显示了java.lang.Short.toString()方法的用法。
package com.iowiki;
import java.lang.*;
public class ShortDemo {
public static void main(String[] args) {
// create short object and assign value to it
short sval = 50;
Short shortValue = new Short(sval);
// returns a String object representing this Short value.
System.out.println("Value is = " + shortValue.toString());
// returns a String object representing the specified short
System.out.println("Value of specified short is = "
+ Short.toString((short)sval));
}
}
让我们编译并运行上面的程序,这将产生以下结果 -
Value is = 50
Value of specified short is = 50