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\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 ]

posted on 2015-10-27 23:47  荷楠仁  阅读(334)  评论(0编辑  收藏  举报

导航