Reputation: 18068
I have a
class A{ public final static String S = "A"
public void getS(){return S;}
}
class B extends A {public final static String S "B"}
Is it possible by reflection or something like that to return by getS()
method value "B"
instead of "A"
without overriding it in subclasses in that situation:
B b = new B();
b.gets(); // I would like RESULT "B"
Upvotes: 0
Views: 36
Reputation: 449
Why don't you override getS() in B?
If you do, then you will be able to get B instead of A.
Upvotes: 1