带有示例的 Scala Char ^(x: Int) 方法
^(x: Int)方法用于在参数列表中找到所述字符和给定整数类型的“x”的按位异或。
Method Definition: def ^(x: Int): Int
Return Type: It returns the bit-wise XOR of the stated character and given Integer type “x”.
示例:1#
// Scala program of ^(x: Int)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying ^(x: Int) method
val result = 'B'.^(1)
// Displays output
println(result)
}
}
输出:
67
示例:2#
// Scala program of ^(x: Int)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying ^(x: Int) method
val result = 'B'.^(20)
// Displays output
println(result)
}
}
输出:
86