java中变量的几种名称fileds,parameters,arguments

来源:互联网 发布:更新mac系统版本出错 编辑:程序博客网 时间:2024/05/20 02:25

java中的变量有好几种类型(此处的类型不是指type,基础类型或者某个java对象),可以根据变量的声明位置和变量的出现时间分类,以下英文摘自oracle的官方JDK tutorial。使用单词可以更清晰的理解变量。

There are several kinds of variables:

Member variables in a class—these are called fields.
Variables in a method or block of code—these are called local variables.
Variables in method declarations—these are called parameters.

Note: Parameters refers to the list of variables in a method declaration. Arguments are the actual values that are passed in when the method is invoked. When you invoke a method, the arguments used must match the declaration’s parameters in type and order.

java中变量(variables)按照其声明的位置可以分为以下几种:
1、fields. 字段。声明在类里面。
2、parameters 参数。声明在方法或者构造器的()里。
3、local variables 本地变量。 声明在方法体里或者构造器里。
以上都是静态变量的名称。

arguments:(英文解释中不是argument的复数)
是java在runtime的时候,JVM调用方法或者构造器时传入的参数。

0 0