Constant Declarations

Practice Questions

Computer Science › Constant Declarations

Questions
2
1

Which of the following code samples adequately uses constants?

2

In the following block of code, which of the following lines contains an error?

final int i = 20, j, k;

int l,m=50,n = 2;

j = n + m;

l = m * i + j;

for(int a = 0; a < m; a++) {

l += l;

}

m = 20 + j + n * i + m;

j = m + i;

k = 50 + 20 * j;

Return to subject