Scala Int <<(x: Long) 方法与示例
<<(x: Long)方法用于返回一个值,该值是 int 值左移指定的 long 值的结果。
Method Definition: (Int_Value).<<(Long_Value)
Return Type: It returns a value which is the result of the int value left bit shifting by the specified long value.
示例 #1:
// Scala program of Int <<(x: Long)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int <<(x: Long) function
val result = (15).<<(2)
// Displays output
println(result)
}
}
输出:
60
示例 #2:
// Scala program of Int <<(x: Long)
// method
// Creating object
object GfG
{
// Main method
def main(args:Array[String])
{
// Applying Int <<(x: Long) function
val result = (15).<<(3)
// Displays output
println(result)
}
}
输出:
120
在评论中写代码?请使用 ide.geeksforgeeks.org,生成链接并在此处分享链接。