代码如下:
def out = System.out // 也可以用import static System.out as out
def endl = '\n'

out << 'a' << ' ' << 'b' << endl
out << 1 << endl
out << 'abcdefg' << endl

这段代码可能没有什么实用价值,顶多只能展现一下Groovy的能力而已。
评论
agile_boy 2008-05-18
endl可以使用File的常量,就更通用了
山风小子 2008-05-17
有意思
发表评论

您还没有登录,请登录后发表评论