Scala Double /(x: Char) 方法
在 Scala 中,Double 是一个 64 位浮点数,相当于 Java 的 double 基本类型。 /(x: Char)方法用于返回该值与给定值 x 的商。
Method Definition – def /(x: Char): Double
Returns – Returns the quotient of this value and x.
示例 #1:
// Scala program to explain the working
// of Double /(x: Char) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying /(x: Int) function
val result = (172.0021.toDouble)./('A':Char)
// Displays output
println(result)
}
}
输出:
2.646186153846154
示例 #2:
// Scala program to explain the working
// of Double /(x: Char) method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying /(x: Char) function
val result = (116.0123.toDouble)./('G':Char)
// Displays output
println(result)
}
}
输出:
1.6339760563380281