Escolar Documentos
Profissional Documentos
Cultura Documentos
a) It doesn't compile
b) 2 arrays of int
c) 1 array of int and 1 int
d) 2 variables of type int
e) none of above
Exercises
Creating And Using Arrays
4) Consider the following code.
class References {
String nomes;
String[] sobrenomes = new String[3];
public static void main(String... args) {
References temp = new References();
}
}
a) []int y;
b) int y[];
c) int[]y;
d) int[ ]y;
e) int[ ] y;
class Teste {
public static void main(String... a) {
int A[] = new int[23]; //B
int B[] = new int[3] { 0, 1, 2}; //C
int C[] = new int[] { 4, 5}; //A
int D[] = { 3, 4, 5 }; } } //D
Exercises
Creating And Using Arrays
a) D
b) A
c) C
d) B
e) The code compiles
class A {
public static void main(String[] args) {
int x[] = {2,3,4};
System.out.println(x[x.length] + " " + x[x.length 1]);
}
}
a) 43
b) 34
c) 33
d) 44
e) It doesn't compile
a) x[24] is 0
b) x[24] is undefined
c) x[25] is '\0'
d) x[0] is "\0"
e) x[24] is null