나는 두 가지 질문이 있습니다풀은 언제 바뀌나요?
public static void main(String[] args) {
String s1 = "bla";
String s2 = "b" +"l" + "a";
String s3 = "b".concat("l").concat("a");
if(s1 == s2)
System.out.println("Equal");
else
System.out.println("Not equal");
if(s1 == s3)
System.out.println("Equal");
else
System.out.println("Not equal");
}
왜
s1
와 같은 객체에s2
점,s1
및s3
하지 않는 반면합니까? (키워드의 사용이 없음).나는이 선 사용자로부터 문자열을 얻고 위의 코드에 추가하는 경우 : 사용자가
xyz
를 입력하면BufferedReader in=new BufferedReader(new InputStreamReader(System.in)); String name=in.readLine(); if(name.equals("test")) s1 = s1 + "xyz";
을 프로그램이 사용자가 프로그램 출력
Equal
다른 일을 입력Not equal
을 인쇄합니다 . 이것은 전체 프로그램 실행을 통해 풀이 변경된다는 것을 의미합니까? 옵티마이 저가 컴파일시에 작동 하나 은runtime
에서 계속 작동합니까?