Class -3- What will be the result when you try to compile and run the following code?
package net.dharmaraj;
class Base {
Base() {
int i = 100;
System.out.println(i);
}
}
public class Pri extends Base {
static int i = 200;
public static void main(String argv[]) {
Pri p = new Pri();
System.out.println(i);
}
}
1) Error at compile time
2) 200
3) 100 followed by 200
4) 100
No comments:
Post a Comment