groovy学习(四)io

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 ', [])
def a = 10
def b = 15
printf("The sum of %d and %d is %d ", [a, b, a + b])

def x = 1.234
def y = 56.78
printf('%f from %f gives %f ', [y, x, x - y])

printf('[%s] ', ["Hello there"])
printf('[%20s] ', ["Hello there"]) // [ Hello there]
printf('[%-20s] ', ["Hello there"]) // [Hello there ]
原文地址:https://www.cnblogs.com/zhouyang209117/p/4916032.html