Main.java
class Main { public static boolean test(String a, String b) { return a == b; } public static void main(String[] args) { System.out.println(test("foo", "foo")); System.out.println(test("foo", "fo" + (Math.random() > 0.5 ? "o" : "o"))); String o = "o"; System.out.println(test("foo", "fo"+o)); } }
Output