About Question com.enthuware.ets.scjp.v6.2.531 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
desertrat
Posts: 1
Joined: Fri Jul 31, 2015 12:46 am
Contact:

About Question com.enthuware.ets.scjp.v6.2.531 :

Post by desertrat »

Code: Select all

class A
{
  public A() {} // A1
  public A(String s) {  this();  System.out.println("A :"+s);  }  // A2
}
class B extends A
{
  public int B(String s) {  System.out.println("B :"+s);  return 0; } // B1
}
class C extends B
{
    private C(){ super(); } // C1
    public C(String s){  this();  System.out.println("C :"+s);  } // C2
    public C(int i){} // C3
}
How can this code compile when Class B does not have a no arg constructor and super() is called from C in the constructor?

edit: n/m I missed that there is only a method claimed in class B (not a constructor). Time for bed!

Post Reply

Who is online

Users browsing this forum: No registered users and 47 guests