Scala 的四种打印

mark

直接 print()

print("000")

换行 println()

println("111")

格式化打印 printf()

val name = "Bob"
val age = 12
val addr = "SiChuan"

printf("name = %s ; age = %d ; addr = %s",name,age,addr)

字符串插值

val name = "Bob"
val age = 12
val addr = "SiChuan"

print(s"name = $name ; age = $age ; addr = $addr")
发表评论 / Comment

用心评论~