Scala Int isValidLong() 方法与示例
如果指定的 int 数为零或位于 scala.long MinValue 和 MaxValue 的范围内,则使用isValidLong()方法返回 true;否则返回假。
Method Definition: (Int_Number).isValidLong
Return Type: It returns true if the specified number is either zero or lies within the range of scala.long MinValue and MaxValue; otherwise returns false.
示例 #1:
// Scala program of Int isValidLong()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying isValidLong method
val result = (0).isValidLong
// Displays output
println(result)
}
}
输出:
true
示例 #2:
// Scala program of Int isValidLong()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying isValidLong method
val result = (5).isValidLong
// Displays output
println(result)
}
}
输出:
true