📄 formalparametertest.groovy
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -