📄 strings.java
字号:
package Operator;
/*
String objects are given special treatment by the Java language.
It is also important to differentiate how String objects behave
when compared to regular objects. (字符串对象与普通对象之间的区别)
*/
class Strings {
public static void main(String [] args) {
String x = "Java";
String y = x;
System.out.println("y string = " + y);
x = x + " Bean";
System.out.println("y string = " + y);
}
}
/*
You might think String y will contain the characters Java Bean
after the variable x is changed, because strings are objects.
Let’s examine the output to find out:
y string = Java
y string = Java
As you can see, even though y is a reference variable to the same object
that x refers to, when we change x it does not change y.
This is because a brand new String object is created every time
we use the + operator to concatenate two strings.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -