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

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.

主站蜘蛛池模板: 老河口市| 和田市| 格尔木市| 沽源县| 顺义区| 会宁县| 温泉县| 崇义县| 固安县| 元谋县| 鹤峰县| 屯门区| 新兴县| 临颍县| 偏关县| 阳东县| 平罗县| 安西县| 彭山县| 新闻| 蓝山县| 伊通| 乌兰察布市| 德阳市| 政和县| 江口县| 友谊县| 青岛市| 夏津县| 靖安县| 巩义市| 宣汉县| 垫江县| 年辖:市辖区| 阳谷县| 闽清县| 监利县| 廉江市| 洪雅县| 安福县| 红桥区|