Java:定义术语初始化、声明和赋值 [英] Java: define terms initialization, declaration and assignment

查看:34
本文介绍了Java:定义术语初始化、声明和赋值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 defs 循环,主语是由它们的动词定义的,但动词是未定义的!那么你如何定义它们?

I find the defs circular, the subjects are defined by their verbs but the verbs are undefined! So how do you define them?

循环定义

初始化:初始化一个变量.它可以在声明.

initialization: to initialize a variable. It can be done at the time of declaration.

赋值:为变量赋值.它可以在任何地方完成,只有一次使用最终标识符.

assignment: to assign value to a variable. It can be done anywhere, only once with the final-identifier.

声明:向变量声明值.

[更新,尝试用 lambda calc 理解主题]

D(x type) = (λx.x is declared with type) 
A(y D(x type)) = (λy.y is assigned to D(x type))

%Then after some beta reductions we get initialization.
D(x type) me human                  // "me" declared with type "human"
A(y (D(x type) me human)) asking    // "asking" assigned to the last declaration

%if the last two statemets are valid, an initialization exists. Right?

推荐答案

赋值:丢弃变量的旧值并用新值替换

assignment: throwing away the old value of a variable and replacing it with a new one

初始化:这是一种特殊的赋值:第一个.在初始化对象有null 值之前,原始类型有默认值,例如0false.可与声明结合使用.

initialization: it's a special kind of assignment: the first. Before initialization objects have null value and primitive types have default values such as 0 or false. Can be done in conjunction with declaration.

声明:声明说明变量的类型及其名称.一个变量只能声明一次.编译器使用它来帮助程序员避免错误,例如将字符串值分配给整数变量.在读取或分配变量之前,必须已声明该变量.

declaration: a declaration states the type of a variable, along with its name. A variable can be declared only once. It is used by the compiler to help programmers avoid mistakes such as assigning string values to integer variables. Before reading or assigning a variable, that variable must have been declared.

这篇关于Java:定义术语初始化、声明和赋值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆