compiler-design-eth/javali_tests/HW3_nop90/OperatorTests/OkEquals.javali

32 lines
450 B
Text
Raw Normal View History

2020-01-15 22:32:25 +01:00
// Test the equal/not equal operations, one of the types must be a subtype of the other
class Main {
void main() {
C1 c1;
C2 c2;
C3 c3;
Object o1, o2;
boolean s;
o1 = new Object();
o2 = new Object();
c1 = new C1();
c2 = new C2();
c3 = new C3();
s = o1 == o2;
s = c1 != c2;
s = c3 == c1;
s = o2 != o1;
s = null == c2;
s = o1 == c2;
s = null == o;
}
}
class C1 {}
class C2 extends C1{}
class C3 extends C2{}