Scala Int getClass() 方法与示例
getClass()方法用于返回给定 int 数的类。
Method Definition: (Number).getClass
Return Type: It returns the class of the given number.
示例 #1:
// Scala program of Int getClass()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying getClass method
val result = (2).getClass
// Displays output
println(result)
}
}
输出:
int
示例 #2:
// Scala program of Int getClass()
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying getClass method
val result = (27987696).getClass
// Displays output
println(result)
}
}
输出:
int