Scala Double *(x: Short) 方法
在 Scala 中,Double 是一个 64 位浮点数,相当于 Java 的 double 基本类型。 *(x: Short)方法用于返回指定的 Double 值和 Short 值的乘积。
Method Definition – def *(x: Short)
Returns – Returns the product of this value and x.
示例 #1:
// Scala program to explain working of
// Double *(x: Short) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying *(x: Short) function
val result = (10.002200.toDouble).*(4:Short)
// Displays output
println(result)
}
}
输出:
40.0088
示例 #2:
// Scala program to explain working of
// Long *(x: Short) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying *(x: Short) function
val result = (15.002250.toDouble).*(5:Short)
// Displays output
println(result)
}
}
输出:
75.01125