带有示例的 Scala Char self() 方法
self()方法用于返回指定的字符本身。
Method Definition: def self: Char
Return Type: It returns Char.
示例:1#
// Scala program of self()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying self() method
val result = ('F').self
// Displays output
println(result)
}
}
输出:
F
示例:2#
// Scala program of self()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying self() method
val result = ('9').self
// Displays output
println(result)
}
}
输出:
9