⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 methodcallwithoutparenthesistest.groovy

📁 大名鼎鼎的java动态脚本语言。已经通过了sun的认证
💻 GROOVY
字号:
class MethodCallWithoutParenthesisTest extends GroovyTestCase {    def flag    void testMethodCallWithOneParam() {        flag = false                methodWithOneParam "hello"                assert flag    }        void testMethodCallWithOneParamUsingThis() {        flag = false                this.methodWithOneParam "hello"                assert flag    }        void methodWithOneParam(text) {        println("Called method with parameter ${text}")        assert text == "hello"        flag = true    }        void testMethodCallWithTwoParams() {        methodWithTwoParams 5, 6        // not allowed in New Groovy        // value = methodWithTwoParams 5, 6        def value = methodWithTwoParams(5, 6)        assert value == 11    }        void testMethodCallWithTwoParamsUsingThis() {        def value = this.methodWithTwoParams(5, 6)                assert value == 11    }    def methodWithTwoParams(a, b) {        println("Called method with parameters ${a} and ${b}")        return a + b    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -