About Question enthuware.ocajp.i.v8.2.1037 :

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

Moderator: admin

Post Reply
scyber
Posts: 3
Joined: Sat Jul 08, 2017 4:42 am
Contact:

About Question enthuware.ocajp.i.v8.2.1037 :

Post by scyber »

class TestBase{
public void methodA(){
System.out.println("base - MethodA");
}
}
class Sub extends Base{
public void methodA(){
System.out.println("sub - MethodA");
}
public void methodB(){
System.out.println("sub - MethodB");
}
public static void main(String args[]){
Base b = new Sub(); //1
b.methodA();
b.methodB();
}
}
Compilation fail!!
The methodA/B can't be resolved in such example.

Any idea?

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.ocajp.i.v8.2.1037 :

Post by admin »

Did you read the explanation? It explains exactly what you are asking.
And, please use the code exactly as given in the question. The name of the class as given in the question is Base. Not TestBase.
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 39 guests