You can make a class abstract by declaring it with keyword abstract. An abstract class normally contains none, one or more abstract methods. An abstract method is an instance method with keyword abstract in its declaration. True False

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
icon
Related questions
Question

3.

 

You can make a class abstract by declaring it with keyword abstract. An abstract class
normally contains none, one or more abstract methods. An abstract method is an
instance method with keyword abstract in its declaration.
True
False
The code will compile successfully when as long as a static method calls an instance
method in the same class by using only the method name, and a static method tries
to access an instance variable in the same class by using only the variable name.
True
False
Transcribed Image Text:You can make a class abstract by declaring it with keyword abstract. An abstract class normally contains none, one or more abstract methods. An abstract method is an instance method with keyword abstract in its declaration. True False The code will compile successfully when as long as a static method calls an instance method in the same class by using only the method name, and a static method tries to access an instance variable in the same class by using only the variable name. True False
All the following statements about abstract methods are incorrect EXCEPT:
We use abstract methods to define features by specifying the details.
O All the methods in the subclasses must not be overloaded
If a single abstract method is abstract, the class may not be abstract.
We can instantiate a class that has an abstract method
If all abstract methods are overridden, the class is not concrete
Given classes Xyz and Abc (See Figure 401):
public abstract class Xyz{
public abstract void run();
}
public class Abc extends Xyz{
@Override
protected void run() {}
} // Figure 401
Why does the Java compiler refuse to compile the program?
Method run() in class Abc does not have any statements inside { and }, so should
be marked abstract
Method run() in class Abc must be marked public
Method run() in class Abc must be marked private
O O O O
Transcribed Image Text:All the following statements about abstract methods are incorrect EXCEPT: We use abstract methods to define features by specifying the details. O All the methods in the subclasses must not be overloaded If a single abstract method is abstract, the class may not be abstract. We can instantiate a class that has an abstract method If all abstract methods are overridden, the class is not concrete Given classes Xyz and Abc (See Figure 401): public abstract class Xyz{ public abstract void run(); } public class Abc extends Xyz{ @Override protected void run() {} } // Figure 401 Why does the Java compiler refuse to compile the program? Method run() in class Abc does not have any statements inside { and }, so should be marked abstract Method run() in class Abc must be marked public Method run() in class Abc must be marked private O O O O
Expert Solution
steps

Step by step

Solved in 4 steps

Blurred answer
Knowledge Booster
Reference Types in Function
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,