groovy学习(四)io

时间:2021-12-23 16:42:06
package ch5

numbers = [11, 12, 13, 14]
def staffTel = ['Ken' : 2745, 'John' : 2746, 'Jessie' : 2772]
println("Numbers:${numbers}") //双引号中的内容会被解释
println('Staff telephone:${staffTel}') //单引号中的内容不会被解释 printf('My name is Ken', [])
printf('My name is Ken\n', [])
def a = 10
def b = 15
printf("The sum of %d and %d is %d \n", [a, b, a + b]) def x = 1.234
def y = 56.78
printf('%f from %f gives %f \n', [y, x, x - y]) printf('[%s]\n', ["Hello there"])
printf('[%20s]\n', ["Hello there"]) // [ Hello there]
printf('[%-20s]\n', ["Hello there"]) // [Hello there ]