在面试的时候,equals和== 的区别基本上是逃不过的问题,那么都是等于,equals和 ==究竟有什么区别呢?
首先看这样一段代码:
package Demo1;
public class TestDemo2 {
public static void main(String[] args) {
String s1 = "hello";
String s2 = "hello";
String s3 = new String("hello"
在面试的时候,equals和== 的区别基本上是逃不过的问题,那么都是等于,equals和 ==究竟有什么区别呢?
首先看这样一段代码:
package Demo1;
public class TestDemo2 {
public static void main(String[] args) {
String s1 = "hello";
String s2 = "hello";
String s3 = new String("hello"