adplus-dvertising
frame-decoration

Question

Which two classes use the Shape class correctly?
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.

B,E

b.

A,C

c.

C,E

d.

T,H

Answer: (a).B,E

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which two classes use the Shape class correctly?

Similar Questions

Discover Related MCQs

Q. What is not type of inheritance?

Q. Using which of the following, multiple inheritance in Java can be implemented?

Q. All classes in Java are inherited from which class?

Q. In order to restrict a variable of a class from inheriting to subclass, how variable should be declared?

Q. If super class and subclass have same variable name, which keyword should be used to use super class?

Q. Static members are not inherited to subclass.

Q. Which of the following is used for implementing inheritance through an interface?

Q. Which of the following is used for implementing inheritance through class?

Q. What would be the result if a class extends two interfaces and both have a method with same name and signature?

Q. Does Java support multiple level inheritance?

Q. Which of this keyword can be used in a subclass to call the constructor of superclass?

Q. What is the process of defining a method in a subclass having same name & type signature as a method in its superclass?

Q. Which of these keywords can be used to prevent Method overriding?

Q. Which of these is correct way of calling a constructor having no parameters, of superclass A by subclass B?

Q. Which of these is supported by method overriding in Java?

Q. What are the features of an Object Oriented Programming (OOPs)?

Q. What are the features reused using Inheritance in Java?

Q. The class that is being inherited or subclassed is called ___.

Q. The class that inherits an already defined class is called ___.

Q. Java language supports ___ type of inheritance.