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. max函数的用法

    题目是   给你一段全英文本,求这段文本中出现次数最多的字母 import string def checkio(text): text = text.lower() return max(strin ...

  2. Python标准库time

    原文:http://www.cnblogs.com/qq78292959/archive/2013/03/22/2975786.html Python官方文档 在程序中,免不了和时间打交道,要学习ti ...

  3. Tinghua Data Mining 3

    特征选择 男女身高 男女抽烟 先验分布 熵 衡量系统的不确定性 属性的价值 降低了不确定性 降低的幅度越高越好 主成分分析 旋转是的数据间的correlation消失掉 Q是正交阵 七长八短,长宽相关 ...

  4. github添加版本号

    1.将官方的库clone下来 http://github.com/xxx.xxx.git 2.修改要修改的地方 3.git add src 4.commit -m 'xxx'   5.git push ...

  5. js实现屏幕自适应局部

    <!doctype html> <html> <head> <meta charset="utf-8"> <title> ...

  6. AJPFX关于VIM的常用快捷键

    Ajax技术的核心是XMLHttpRequest对象(简称XHR),var xhr = new XMLHttpRequest();function createXHR(){if (typeof XML ...

  7. 在CentOS 6.7 64位安装PHP的PDO_OCI扩展 Installing PDO_OCI extension on CentOS 6.7 64bit

    需求&背景 最近根据项目需求,要在php中远程连接Oracel 11g Express数据库,为了开发方便,决定采用pdo,也就是php的PDO_OCI扩展,但是php安装的时候并没有安装PD ...

  8. Vue.js中data,props和computed数据

    data data 是Vue实例的数据对象.Vue将会将data 的属性转换为 getter/setter, 也就是用Object.defineProperty方法(在官网里面有深入响应式原理里面具体 ...

  9. leetcode287 Find the Duplicate Number

    思路: 转换成链表之后使用floyed判环法.转换之后重复的那个数字是唯一一个有多个前驱和一个后继的节点,因此是环的起始节点. 实现: class Solution { public: int fin ...

  10. CSS 布局说——可能是最全的

    前言 现在,我们被称为前端工程师.然而,早年给我们的称呼却是页面仔.或许是职责越来越大,整体的前端井喷式的发展,使我们只关注了js,而疏远了css和html. 其实,我们可能经常在聊组件化,咋地咋地. ...