compiler-design-eth/javali_tests/HW2_nop90/Arrays.javali

24 lines
499 B
Text
Raw Permalink Normal View History

2020-01-15 22:30:09 +01:00
/* testing arrays with primitive types as well as new objects
the if/else statements shows that the array is boolean array is initialized with false
*/
class Main {
void main() {
int [] testArray;
boolean [] boolarray;
boolarray = new boolean [3];
testArray = new int [10];
testArray[5] = 3;
boolarray[1] = true;
if (boolarray[0]){
write(1);}
else{
write(5);}
writeln();
if (boolarray[1]){
write(1);}
}
}