About Question enthuware.ocajp.i.v7.2.885 :
Moderator: admin
-
- Posts: 2
- Joined: Tue Jun 03, 2014 9:30 am
- Contact:
About Question enthuware.ocajp.i.v7.2.885 :
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
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
-
- Site Admin
- Posts: 10060
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.885 :
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.
If a class has an abstract method, it must be declared as abstract.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 2
- Joined: Tue Jun 03, 2014 9:30 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.885 :
Sorry you're right. Wouldn't class Shape become an abstract class?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.
-
- Site Admin
- Posts: 10060
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.885 :
Yes, but you still have to put abstract keyword in the class declaration to make it compile.clayDustin wrote:Sorry you're right. Wouldn't class Shape become an abstract class?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.
If you like our products and services, please help us by posting your review here.
-
- Posts: 221
- Joined: Mon Nov 26, 2018 2:43 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.885 :
General Question: How indicative of the real test is/was this last day test? Thanks
-
- Site Admin
- Posts: 10060
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.885 :
Quite indicative.
If you like our products and services, please help us by posting your review here.
-
- Posts: 202
- Joined: Mon Apr 02, 2018 8:40 am
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.885 :
Had this been an option would it be correct:
and also this one:
Code: Select all
public abstract class Shape {
and
public class Circle extends Shape {
Code: Select all
abstract class Shape {
and
class Circle extends Shape {
-
- Site Admin
- Posts: 10060
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.885 :
1. Yes.
2. Yes.
2. Yes.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: mcpunjabi and 109 guests