Having said that, the remainder of this tutorial uses the following general guidelines when discussing fields and variables. If we are talking about "fields in general" (excluding local variables and parameters), we may simply say "fields". If the discussion applies to "all of the above", we may simply say "variables". If the context calls for a distinction, we will use specific terms (static field, local variables, etc.) as appropriate. You may also occasionally see the term "member" used as well. A type's fields, methods, and nested types are collectively called its members.
 
先说一下 field 和 variable 之间的区别:
class variables and instance variables are fields while local variables and parameter variables are not. All fields are variables.
成员变量(field)是指类的数据成员,而方法内部的局部变量(local variable)、参数变量(parameter variable)不能称作 field。field 属于 variable,也就是说 variable 的范围更大。
术语解释:
域或字段、实例变量、成员变量(field, instance variable, member variable, non-static field)
field: A data member of a class. Unless specified otherwise, a field is not static.
非 static 修饰的变量。
虽然有如上定义,但是一般在使用时,成员变量(field)包括 instance variable 和 class variable。为了区分,个人认为,用实例变量/非静态变量(instance variable / non-static field)描述上面的定义更佳。
成员变量与特定的对象相关联,只能通过对象(new 出)访问。
声明在类中,但不在方法或构造方法中。
如果有多个对象的实例,则每一个实例都会持有一份成员变量,实例之间不共享成员变量的数据。
作用域比静态变量小,可以在类中或者非静态方法中使用以及通过生成实例对象使用。(访问限制则不可用)
JVM 在初始化类的时候会给成员变量赋初始值。
Example:
类字段、静态字段、静态变量(class variable, static field, staic variable)
使用 static 修饰的字段,一般叫做静态变量。
声明在类中,但不在方法或构造方法中。
多个实例对象共享一份静态变量
JVM在准备类的时候会给静态变量赋初始值。
作用域最大,类中都可以访问,或通过 类名.变量名 的方式调用(访问限制则不可用)。
Example:
局部变量(local variable)
定义在一个区块内(通常会用大括号包裹),区块外部无法使用的变量。
定义在一个区块内(通常会用大括号包裹),没有访问修饰符,区块外部无法使用的变量。
没有默认值,所以必须赋初始值
生命周期即为方法的生命周期
Example:
参数(input parameter, parameter (variable), argument)
这个就不多说了,要注意的是 argument 和 parameter 的区别(下文)。
另外,Oracle 官方文档中将参数分为了构造参数、方法参数和异常参数三部分。
Example:
Strictly speaking, a parameter is a variable within the definition of a method. An argument would be the data or actual value which is passed to the method. An example of parameter usage: int numberAdder(first, second) An example of argument usage: numberAdder(4,2)
不可变量、常量(final variable, constant)
即为使用 final 关键词修饰的变量。不可变量属于成员变量。
成员(member)
A field or method of a class. Unless specified otherwise, a member is not static.
指的是类中非静态的成员变量或方法。(用法同field)
属性(property)
Characteristics of an object that users can set, such as the color of a window.
可以被用户设置或获取的对象特征即为属性。
POJO 或 JavaBean 中的成员变量也称作属性(具有set、getter方法)。
最后,总结一下国内目前的惯用法(英文取其一,序号对应上文):
field -> 成员变量, instance variable / non-static field -> 实例变量/非静态变量
class variable -> 静态变量
local variable -> 本地变量
input parameter -> 参数
final variable -> 常量
member -> 成员(用法同field)
property -> 属性返回搜狐,查看更多

【java】 field 和 variable 区别及相关术语解释的更多相关文章

  1. 【SSO单点系列】(6):CAS4.0 单点流程序列图(中文版)以及相关术语解释(TGT、ST、PGT、PT、PGTIOU)

    CAS 相关的内容好久没写了,可能下周会继续更新一些内容吧. 在上一篇中的单点流程序列图由于是从官网直接下载来的,上面都是英文,可能有的朋友看不懂,因此修改成中文的. PS:只修改了一个,第二个图明天 ...

  2. java field, property,variable及getField和getDeclaredField的区别

    java 里面的field ,property, attribute,variable的区别 field: 就是定义的用于保存数据的字段 property: property是用于描述类中的特征,所以 ...

  3. Java 并发,相关术语

    Java 并发,相关术语: 术语 作用 synchronize 可修饰方法.代码块.类:介绍:https://www.cnblogs.com/zyxiaohuihui/p/9096882.html L ...

  4. Java和C++的区别

    这是一个Java语言和C++语言之间的比较. 目录 [隐藏]  1 设计目标 2 语言特性 2.1 语法 2.2 语义 2.3 资源管理 2.4 库 2.5 运行时 2.6 模板 vs. 泛型 2.7 ...

  5. 前端入门7-JavaScript语法之相关术语

    声明 本系列文章内容全部梳理自以下几个来源: <JavaScript权威指南> MDN web docs Github:smyhvae/web Github:goddyZhao/Trans ...

  6. Spring的AOP开发的相关术语

    转载自 https://www.cnblogs.com/ltfxy/p/9873618.html SpringAOP简介: AOP思想最早是由AOP联盟组织提出的.Spring使用这种思想最好的框架. ...

  7. Spring框架学习05——AOP相关术语详解

    1.Spring AOP 的基本概述 AOP(Aspect Oriented Programing)面向切面编程,AOP采取横向抽取机制,取代了传统纵向继承体系重复性代码(性能监视.事务管理.安全检查 ...

  8. Dalvik VM (DVM) 与Java VM (JVM) 的区别?

    Dalvik虚拟机存在于Android系统,JVM是java虚拟机,两者都是虚拟机,本文就对两者进行比较,讲述它们的不同. Dalvik虚拟机是Google等厂商合作开发的Android移动设备平台的 ...

  9. Spring AOP相关术语

    ---------------------siwuxie095                                 Spring AOP 相关术语         (1)Joinpoint ...

随机推荐

  1. JavaScript 对象的原型扩展(JS面向对象中的继承)

    <script type="text/javascript"> function person(name, age) { this._name = name; this ...

  2. android studio ffmpeg简单使用 (cmake)

    编译ffmpeg android studio 新建项目,勾选上 将编译好的libffmpeg.so库扔到src/main/jniLibs/armeabi下(主要这里我只编译了arm的ffmpeg的库 ...

  3. PostgreSQL-6-数据分组

    基本语法 SELECT column-list FROM table_name WHERE [ conditions ] GROUP BY column1, column2 HAVING [ cond ...

  4. 2017"百度之星"程序设计大赛 - 资格赛 度度熊的王国战略

    度度熊的王国战略 度度熊国王率领着喵哈哈族的勇士,准备进攻哗啦啦族. 哗啦啦族是一个强悍的民族,里面有充满智慧的谋士,拥有无穷力量的战士. 所以这一场战争,将会十分艰难. 为了更好的进攻哗啦啦族,度度 ...

  5. 洛谷 P1067 多项式输出

    P1067 多项式输出 模拟,很坑的那种 var i,n:longint; a:array[1..105] of integer; begin readln(n); for i:=1 to n+1 d ...

  6. 阿里云ECS基础知识01

  7. linux下svn服务器搭建步骤

    安装步骤如下: 1.yum install subversion 2.输入rpm -ql subversion查看安装位置,如下图:   我们知道svn在bin目录下生成了几个二进制文件. 输入 sv ...

  8. Elasticsearch之探索集群信息

    REST API 启动并运行了节点和集群,下一步是了解如何与它进行通信.elasticsearch提供了一个非常全面和强大的REST API,可以使用它与集群进行交付. 使用API完成以下: • 检查 ...

  9. crontab 在unix 没有执行。

    Quote: 引用 2 楼 jdwq33 的回复: Quote: 引用 1 楼 mp777323 的回复: 03 * * * * sh /opt/pro_some.sh 我试过了,这样也不行,难道是我 ...

  10. MQTT进阶篇

            我们介绍了最流行的物联网协议MQTT的背景以及基本使用方法.在这篇文章中,我们会继续考察MQTT的高级玩法——与网页应用的交互.MQTT是基于TCP协议实现,基于HTTP的网页应用便无 ...