Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Java-Beginners Why does this code prints fAfA instead of fBfA ?
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


shahid
Why does this code prints fAfA instead of fBfA ?
0 Answer(s)      a year 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 ?

Advertisement
View Answers

Related Tutorials/Questions & Answers:
 

 

 

DMCA.com