Java基础名词

本文详细解释了Java中类的各种成员,包括变量(类变量、实例变量、局部变量)、方法及构造器的概念和用法,帮助读者更好地理解Java类的构成。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

member

A field or method of a class. Unless specified otherwise, a member is not static.
一个类由域和方法构成。

variable

An item of data named by an identifier. Each variable has a type, such as int or Object, and a scope. See also class variable, instance variable, local variable.
一共有三种变量:类变量、实例变量和局部变量。

class variable = static field

A data item associated with a particular class as a whole–not with particular instances of the class. Class variables are defined in class definitions. Also called a static field. See also instance variable.
与类本身在一起,而非类创建的实例。

instance variable = field

Any item of data that is associated with a particular object. Each instance of a class has its own copy of the instance variables defined in the class. Also called a field. See also class variable.
field
A data member of a class. Unless specified otherwise, a field is not static.
由类创建出的实例的变量,与实例在一起。

local variable

A data item known within a block, but inaccessible to code outside the block. For example, any variable defined within a method is a local variable and can’t be used outside the method.
方法里创建的变量。还有循环体。

constructor

A pseudo-method that creates an object. In the Java™ programming language, constructors are instance methods with the same name as their class. Constructors are invoked using the new keyword.
与类同名的实例伪方法。

  • 来源:

Java 官方说明文档:
https://docs.oracle.com/javase/tutorial/information/glossary.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值