posted 20 years ago
Question :
By changing which line in the following code can you make it compile with no compile - time errors .
class StatTest {
class Int {
static int x = 10 ; // ---> line 1
int y = 10 ; // ---> line 2
};
static class Inter {
static int x = 10 ; // ---> line 3
int y = 10 ; // ---> line 4
};
};
Options :
a . Remove static from line 1
b . Add static to the declaration on line 2
c . Remove static from line 3
d . Add static to the declaration on line 4
Answer : a.
what is the reason for this?
Can anyone help me out?
Thanks in advance..
regards,
rajani.