Scala Long *(x: Float)方法
在Scala中,Long是一个64位有符号整数,相当于Java的long原始类型。利用*(x: Double)
方法,可以返回指定的Long值与Float值的乘积。
方法定义 – def *(x: Float)
返回 – 返回该值与x的乘积。
例子 #1 :
// Scala program to explain working of
// Long *(x: Float) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying *(x: Float) function
val result = (13.toLong).*(5:Float)
// Displays output
println(result)
}
}
输出
65.0
例子#2
// Scala program to explain working of
// Long *(x: Float) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying *(x: Float) function
val result = (150.toLong).*(5:Float)
// Displays output
println(result)
}
}
输出
750.0