Why does this code prints fAfA instead of fBfA ?

Ads

 
 

Share on Google+Share on Google+

shahid
Why does this code prints fAfA instead of fBfA ?
0 Answer(s)      4 years ago
Posted in : Java Beginners
class B {
    void f(){ System.out.print("fB");}
    B(){f(); }
}
public class A extends B{
    void f(){ System.out.print("fA");}
A(){    f();}
public static void main(String[] args) {
            new A();
}}
Why does this code prints fAfA instead of fBfA ?
Ads
View Answers
Ads