valuetest.java
来自「主要是对于JAVA的编程的基本语言 希望能够帮得上你。」· Java 代码 · 共 29 行
JAVA
29 行
package Operator;
/*
In contrast to objects, primitive number assignments are stored as values.
In other words, primitive variables are assigned to unique values.
*/
class ValueTest {
public static void main (String [] args) {
int a = 10;
System.out.println("a = " + a);
int b = a;
b = 30;
System.out.println("a = " + a + "after change to b");
}
}
/*
The output from this program is the following:
a = 10
a = 10 after change to b
Notice this time the value of a stayed at 10.
This is because primitive types are assigned
by value and not by reference.
(基本数据类型赋值是值传递而不是引用传递)
*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?