Scala Char |(x: Int)方法及示例
|(x: Int)方法用于查找指定字符值和参数列表中给定的“x”进行按位OR运算,该“x”必须是整数。
方法定义:def |(x: Int):Int
返回类型:返回指定字符值和给定整数“x”的按位OR运算结果。
示例:1#
// Scala program of |(x: Int)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying |(x: Int) method
val result = 'A'.|(5)
// Displays output
println(result)
}
}
69
示例:2#
// Scala program of |(x: Int)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying |(x: Int) method
val result = 'A'.|(9)
// Displays output
println(result)
}
}
73
更多Scala相关文章,请阅读:Scala 教程
极客教程