importtest.groovy
来自「大名鼎鼎的java动态脚本语言。已经通过了sun的认证」· GROOVY 代码 · 共 28 行
GROOVY
28 行
import java.io.*import java.util.Mapimport java.util.Listclass ImportTest extends GroovyTestCase { void testImportAll() { def file = new File("foo.txt") assert file instanceof File assert file.getClass().name == "java.io.File" } void testImportByName() { def x = [:] assert x instanceof Map /** * For maps, map.getClass() should be used instead of map.class, * when map has no member, named as "class" */ assert x.getClass() != null assert x.getClass().name.startsWith("java.util.") def y = [1, 2, 3] assert y instanceof List assert y.getClass().name.startsWith("java.util.") }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?