Welcome Guest | Sign in | Register
Abstract - Discussion Page For Q.2487 | Java Programming Questions and Answers | Java Programming Free Online-Tests | LucentBlackBoard | LucentBlackBoard.com

Home > Java Programming > Abstract > Questions and Answers

Q: Given:
1. public abstract class Shape {
2. private int x;
3. private int y;
4. public abstract void draw();
5. public void setAnchor(int x, int y) {
6. this.x = x;
7. this.y = y;
8. }
9. }

Which two classes use the Shape class correctly? (Choose two.)



A.     public class Circle implements Shape {
private int radius;
}
B.     public abstract class Circle extends Shape {
private int radius;
}
C.     public class Circle extends Shape {
private int radius;
public void draw();
}
D. public abstract class Circle implements Shape {
private int radius;
public void draw();
}
E. public class Circle extends Shape {
private int radius;
public void draw() {/* code here */}
}
F. public abstract class Circle implements Shape {
private int radius;
public void draw() {/* code here */}
}

A. AB B. BE
C. AC D. BD
E. CE

Answer and Explanation

Answer:BE

Explanation:
In ans B , child class is a abstract class thats why it is not implementing any abstract property of Shape, and in ans E child class is normal class it implements abstract property of super class Shape.
Ans A is wrong because we should not use implaments keyword to to implement abstract class.

Ans C is also wrong because whenever you write 

Comment on this Question

Name:

Loading...




Partner Sites
LucentBlackBoard.com                  SoftLucent.com                  LucentJobs.com
All rights reserved © 2012-2015 SoftLucent.