错误,因为代码中没有定义变量d1和d2。同时,s1和s2应该用双引号括起来,即:

public class DemoTest{ String s1 = new String("hello"); String s2 = new String("hello"); System.out.println(s1.equals(s2)); }

输出结果为true。

判断2分public class DemoTest	String s1=new Stringhello;String s2=new Stringhello;Systemoutprintlnd1equalsd2;输出结果为ture

原文地址: https://www.cveoy.top/t/topic/cpUZ 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录