📄 valuetest.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -