import java.io.File;
import java.util.Date;
public class ReferenceDemo {
public static void main(String [] args) {
File f1 = new File("mydata.txt");
File f2 = new File("mydata.txt");
if (f1 != f2)
System.out.println("f1 != f2");
Date today = new Date();
Date now = today;
if (today == now)
System.out.println("today == now");
String s1 = "Hello";
String s2 = "Hello";
if (s1 == s2)
System.out.println("s1 == s2");
String x1 = new String("Goodbye");
String x2 = new String("Goodbye");
if (x1 == x2)
System.out.println("x1 == x2");
}
}
What will be printed out?
Ввійдіть щоб вподобати
Ввійдіть щоб прокоментувати