Homework 4

This commit is contained in:
Carlos Galindo 2020-01-15 22:34:57 +01:00
parent 0afc86ceeb
commit 72cc3206c4
Signed by: kauron
GPG key ID: 83E68706DEE119A3
125 changed files with 4200 additions and 1636 deletions

View file

@ -0,0 +1,14 @@
// any array is a subtype of Object
// assignment and 'is equal' with an object of type 'Object' is fine
class Main {
void main() {
boolean y;
Object x;
int[] testArray;
testArray = new int[10];
x = testArray;
testArray = null;
x = null;
}
}

View file

@ -0,0 +1,21 @@
// assignment of subtypes
class Main {
void main() {
A a1, a2;
B b1, b2;
C c;
a1 = new A();
b2 = new B();
c = new C();
a2 = a1;
b1 = c;
}
}
class A {}
class B extends A {}
class C extends B {}