formalparametertest.groovy
来自「大名鼎鼎的java动态脚本语言。已经通过了sun的认证」· GROOVY 代码 · 共 29 行
GROOVY
29 行
package gls.ch08.s04import gls.scope.CompilableTestSupport/*** a formal parameter is a parameter to a method, this parameter must work* as any local variable. But we generally do boxing on local variables, which* is not possible for formal parameters. The type is givven through the* method signature.*/class FormalParameterTest extends CompilableTestSupport{ void testPrimitiveParameterAssignment(){ // test int and long as they have different lengths on in the bytecode assert intMethod(1i,2i) == 2i assert longMethod(1l,2l) == 2l } int intMethod(int i, int j) { i=j return i } long longMethod(long i, long j) { i=j return i }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?