Orion beta

Greenhorn
+ Follow
since May 31, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Orion beta

Would u pls answer my questions on the mock exam from China IT Lab.
Q2. "A class defined within a method can only access final methods of the enclosing method" is true
Why there is 'final methods' the enclosing method?
Does it means that the enclosing method contains final method which is accessible by inner class?

Q7.
class A{
protected int i;

A(int i){
this.i=i;
}

}
The answer said that the following class B is NOT a valid inner class for A.
class B{
B(){
System.out.println("i = "+i );
}
}

But why? I have tried the code and it CAN compile!!

Q83.
What will happen when try to compile and run the following code?
public class CEx{
public static void main(String argv[]){
Base b = new Base();
Sub s = (Sub)b;

}
}
class Base{}
class Sub extends Base{}
class Sub2 extends Base{}
Answer: It will give Runtime exception.
I tried this code and found that it gave ClassCastException.
Is the ClassCastException ALWAYS given when an instance is casted down?
thx a lot!