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. ZOJ 4033 CONTINUE...?(The 15th Zhejiang Provincial Collegiate Programming Contest Sponsored by TuSimple)

    #include <iostream> #include <algorithm> using namespace std; ; int a[maxn]; int main(){ ...

  2. python模块之struct

    # #********struct模块********# # 1.按照指定格式将Python数据转换为字符串,该字符串为字节流,如网络传输时, # 不能传输int,此时先将int转化为字节流,然后再发 ...

  3. JS面向对象方法(二) 面向对象方法实现橱窗式图面预览以及放大功能

     效果图: HTML结构如下: <div id="preview"> <div id="mediumDiv"> <img id=& ...

  4. JavaScript引擎基本原理:Shapes和Inline Caches

    原文链接: JavaScript engine fundamentals:Shapes and line Cahes 这篇文章描述了一些在js引擎中通用的关键点, 并不只是V8, 这个引擎的作者(Be ...

  5. JAVA常用知识总结(七)——Spring

    如果一个接口有2个不同的实现, 如何Autowire某一个指定的实现? 1.通过增加@Qualifier(实现类的名字): @Autowired @Qualifier("GirlStuden ...

  6. 从零开始利用vue-cli搭建简单音乐网站(二)

    1.利用vue-router实现页面跳转 程序可以正常运行之后,下面我们需要配置路由实现页面的局部刷新,这一功能将用来实现网站页面的跳转. 打开程序目录,进入"src\router\inde ...

  7. vue+webpack+VS Code入门简单的项目配置

    为了方便,这边的编译器选择的是VS Code (Visual Studio Code); 打开VS Code,选择好自己的工作空间,然后新建一个文件夹作为我们项目的文件夹,然后,show time: ...

  8. IE兼容只读模式

    表单input具有只读模式属性,一般来说,一般的浏览器都支持该属性,即readyonly,但IE不支持,只能寻找其兼容性. 第一种:unselectable='on' <input id=&qu ...

  9. Android Studio项目上传到Jcenter

    一.将你要发布的moudle的build.gradle中添加代码,gradle的最后添加 PUBLISH_GROUP_ID = 'com.zzti.fengyongge' PUBLISH_ARTIFA ...

  10. 【extjs6学习笔记】0.1 准备:基础概念 (01)

    1. Ext.application 应用程序入口点 2. Ext.onReady() 页面加载完成后触发动作 3. Ext.define() 4. Ext.data.proxy.Proxy 5. E ...