compiler-design-eth/javali_tests/HW4/OkDifferentReads.javali

27 lines
392 B
Text
Raw Normal View History

2020-01-15 22:34:57 +01:00
/* Test read() with different kinds of LHS values */
class Main {
int x;
void main() {
int y;
int[] arr;
write(1);
writeln();
y = read();
write(y + 1);
writeln();
x = read();
write(x + 1);
writeln();
arr = new int[64];
arr[x] = read();
write(arr[x] + 1);
writeln();
}
}