Page 1 of 1
About Question enthuware.ocajp.i.v7.2.885 :
Posted: Tue Jun 03, 2014 9:34 am
by clayDustin
Hello,
Given:
//Insert code here
public abstract void draw();
}
//Insert code here
public void draw(){ System.out.println("in draw..."); }
}
Which of the following lines of code can be used to complete the above code?
--I thought if an class contained abstract methods it was automatically represented as an abstract class so that in the case of the first option:
class Shape {
and
class Circle extends Shape {
--class Shape would become an abstract method. Thanks
Re: About Question enthuware.ocajp.i.v7.2.885 :
Posted: Tue Jun 03, 2014 9:50 am
by admin
I am not sure what you mean by, "class Shape would become an abstract method.". A class cannot become a method.
If a class has an abstract method, it must be declared as abstract.
HTH,
Paul.
Re: About Question enthuware.ocajp.i.v7.2.885 :
Posted: Tue Jun 03, 2014 10:05 am
by clayDustin
admin wrote:I am not sure what you mean by, "class Shape would become an abstract method.". A class cannot become a method.
If a class has an abstract method, it must be declared as abstract.
HTH,
Paul.
Sorry you're right. Wouldn't class Shape become an abstract class?
Re: About Question enthuware.ocajp.i.v7.2.885 :
Posted: Tue Jun 03, 2014 10:25 am
by admin
clayDustin wrote:admin wrote:I am not sure what you mean by, "class Shape would become an abstract method.". A class cannot become a method.
If a class has an abstract method, it must be declared as abstract.
HTH,
Paul.
Sorry you're right. Wouldn't class Shape become an abstract class?
Yes, but you still have to put abstract keyword in the class declaration to make it compile.
Re: About Question enthuware.ocajp.i.v7.2.885 :
Posted: Thu Dec 13, 2018 3:56 pm
by OCAJO1
General Question: How indicative of the real test is/was this last day test? Thanks
Re: About Question enthuware.ocajp.i.v7.2.885 :
Posted: Thu Dec 13, 2018 6:46 pm
by admin
Quite indicative.
Re: About Question enthuware.ocajp.i.v7.2.885 :
Posted: Fri Dec 28, 2018 8:09 am
by flex567
Had this been an option would it be correct:
Code: Select all
public abstract class Shape {
and
public class Circle extends Shape {
and also this one:
Code: Select all
abstract class Shape {
and
class Circle extends Shape {
Re: About Question enthuware.ocajp.i.v7.2.885 :
Posted: Fri Dec 28, 2018 9:07 am
by admin
1. Yes.
2. Yes.