Scala Char unary_~() 方法与示例
unary_~()方法用于查找所述字符的按位否定值。
Method Definition: def unary_~: Int
Return Type: It returns bit-wise negative value of the stated character.
示例:1#
// Scala program of unary_~()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying unary_~ method
val result = 'A'.unary_~
// Displays output
println(result)
}
}
输出:
-66
示例:2#
// Scala program of unary_~()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying unary_~ method
val result = 'B'.unary_~
// Displays output
println(result)
}
}
输出:
-67