gpt4 book ai didi

Java:定义术语初始化、声明和赋值

转载 作者:IT老高 更新时间:2023-10-28 20:50:25 31 4
gpt4 key购买 nike

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

循环定义

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

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

声明:向变量声明值。

[更新,尝试用 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?

最佳答案

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

初始化:这是一种特殊的赋值:第一个。在初始化之前,对象具有 null 值,原始类型具有默认值,例如 0false。可以和声明一起做。

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

关于Java:定义术语初始化、声明和赋值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2614072/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com