Homework 3

This commit is contained in:
Carlos Galindo 2020-01-15 22:32:25 +01:00
parent bf60a078d7
commit 0afc86ceeb
Signed by: kauron
GPG key ID: 83E68706DEE119A3
129 changed files with 3163 additions and 4316 deletions

View file

@ -0,0 +1,16 @@
// Test that arrays are not covariant
class Main {
void main() {
boolean y;
A[] Array1;
B[] Array2;
Array2 = new B[10];
Array1 = Array2;
}
}
class B extends A {}
class A {}

View file

@ -0,0 +1,11 @@
// The left-hand side of an assignment cannot be a method call
// Valid options are variable accesses, fields or an indexed array
class Main {
void main() {
action() = read();
}
int action() {
return 0;
}
}

View file

@ -0,0 +1,15 @@
// The left-hand side of an assignment cannot be a reference to this
// Valid options are variable accesses, fields or an indexed array
class Main {
void main () {
int b;
int[] c;
c = new int[5];
this.a = 10;
b = 10;
c[4] = 10;
this = null;
}
int a;
}