Scala Byte <(x: Short): Boolean
在Scala中,Byte是8位有符号整数(相当于Java的byte原始类型)。<(x: Short)方法用于在这个值小于x时返回真,否则返回假。
方法定义: Byte <(x: Short): Boolean
返回类型: 如果这个值小于x,则返回true,否则返回false。
示例 #1:
// Scala program of Byte <(x: Short)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Byte <(x: Short) function
val result = (64.toByte).<(12:Short)
// Displays output
println(result)
}
}
输出:
false
示例 #2:
// Scala program of Byte <(x: Short)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Byte <(x: Short) function
val result = (25.toByte).<(111:Short)
// Displays output
println(result)
}
}
输出:
true
更多Scala相关文章,请阅读:Scala 教程
极客教程