What is the output when folllowing code is run?
1. class OuterOne{
2. class InnerOne extends OuterOne{}
3. static void thisMethod(){
4. Object o=(Object)new OuterOne();
5. OuterOne foo=(OuterOne)o;
6. }
7. public static void main(
String args[]){
8. thisMethod();
9. }
10. }
1. Will compile fine,but at runtime a ClassCastException is thrown
2. Will compile and run fine
3. Compiler error at line 4
4. Compiler error at line 5
Ans: 2
Why code here compiles fine?
The Inner Class here is a member but why it can declare static method?