官术网_书友最值得收藏!

  • Java Data Analysis
  • John R. Hubbard
  • 126字
  • 2021-07-02 18:21:44

Variables

In computer science, we think of a variable as a storage location that holds a data value. In Java, a variable is introduced by declaring it to have a specific type. For example, consider the following statement:

String lastName;

It declares the variable lastName to have type String.

We can also initialize a variable with an explicit value when it is declared, like this:

double temperature = 98.6;

Here, we would think of a storage location named temperature that contains the value 98.6 and has type double.

Structured variables can also be declared and initialized in the same statement:

int[] a = {88, 11, 44, 77, 22};

This declares the variable a to have type int[] (array of ints) and contain the five elements specified.

主站蜘蛛池模板: 隆回县| 新建县| 平原县| 丹巴县| 曲水县| 浑源县| 开封市| 乌兰察布市| 张家口市| 青冈县| 鸡东县| 红桥区| 全椒县| 黄骅市| 涞水县| 河西区| 堆龙德庆县| 林芝县| 贵州省| 阳东县| 中超| 修水县| 皮山县| 齐河县| 庄河市| 阳东县| 临安市| 上蔡县| 基隆市| 斗六市| 桐城市| 湘潭县| 北安市| 友谊县| 周宁县| 闵行区| 滁州市| 马边| 达拉特旗| 黄龙县| 北碚区|