Java术语的定义:参数

Parameters are the variables that are listed as part of a method declaration. Each parameter must have a unique name and a defined data type.

参数是作为方法声明的一部分列出的变量。 每个参数必须具有唯一的名称和定义的数据类型。

参数示例 ( Parameter Example )

Within a method to compute a change to a Circle object's position, the method changeCircle accepts three parameters: a name of a Circle object, an integer representing a change to the X-axis of the object and an integer representing a change to the Y axis of the object.

在用于计算Circle对象位置变化的方法中, changeCircle方法接受三个参数:Circle对象的名称,代表对象X轴变化的整数和代表Y轴变化的整数对象。

public void changeCircle(Circle c1, int chgX, int chgY) {
c1.setX(circle.getX() + chgX);
c1.setY(circle.getY() + chgY);
}

When the method is called using example values (e.g., changeCircle(Circ1, 20, 25)), the program will move the Circ1 object up 20 units and right 25 units.

当使用示例值(例如changeCircle(Circ1,20,25) )调用该方法时, 程序会将Circ1对象向上移动20个单位,向右移动25个单位。

关于参数 ( About Parameters )

A parameter may be of any declared data type -- either primitives like integers, or reference objects including arrays. If a parameter may become an array of an indeterminant number of data points, create a ​vararg by following the parameter type with three periods (an ellipsis) and then specifying the parameter name.​

参数可以是任何已声明的数据类型-整数之类的原语,或包括数组的引用对象。 如果参数可以成为数据点的超静定数目的阵列,通过以下三个周期(省略号),然后指定参数名称的参数类型创建一个可变参数

翻译自: https://www.thoughtco.com/parameter-2034268

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值