Java: define terms initialization, declaration and assignment

后端 未结 7 699
轻奢々
轻奢々 2020-11-22 16:12

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

The Circular Definitions

7条回答
  •  时光取名叫无心
    2020-11-22 17:16

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

    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.

提交回复
热议问题