Hi,
how come in this code there is no compiler error at line 2. It gives me a compiler error at line 4. Both are not a valid statement right.
By commenting out which line will the following class compile with no errors
class ZZY {
transient final int i = 0;
transient final static int j = 10 ;
int k = 78 ;
char jack(){
return 'a';
}
public static void main (
String args [ ]) { // ---> 1
new ZZY ( ) . jack ( ) ; // ---> line 2
int d = new ZZY ( ) . j + new ZZY ( ) . i ; // ---> line 3
new ZZY ( ) . k ; // ---> line 4
System . out . println ( new ZZY ( ) . i + " " + new ZZY ( ) . j ) ; // ---> line 5
}
}
Options :
a . line 1
b . line 2
c . line 3
d . line 4
e . line 5
Thanks
Srividhya