mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-20 11:36:16 +07:00
26 lines
628 B
Java
26 lines
628 B
Java
class Main {
|
|
|
|
public static String getSameObject() {
|
|
return ""; // same object for any call
|
|
}
|
|
|
|
public static Main getNewObject() {
|
|
return new Main(); // different objects for different subsequent calls
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
Main m = new Main();
|
|
|
|
if (m.getSameObject() == m.getSameObject()) {
|
|
System.out.println("This will get printed");
|
|
}
|
|
|
|
if (m.getNewObject() == m.getNewObject()) {
|
|
System.out.println("This will not get printed");
|
|
}
|
|
|
|
if (Main.getNewObject() == Main.getNewObject()) {
|
|
System.out.println("This will not get printed");
|
|
}
|
|
}
|
|
} |