The abstract method must be in the abstract class, whether this sentence is true or false

Updated on educate 2024-05-20
10 answers
  1. Anonymous users2024-02-11

    The method in the interface does not have a method body, as long as the interface is implemented, the method must be implemented, so there is no need to add abstract

    But abstract classes are different, and methods in abstract classes can have method bodies, but at least one method that has not been implemented. And the abstract declaration must be used.

  2. Anonymous users2024-02-10

    When programming, interfaces are often used for the reason that they are only related to functions, but they are not concerned with the specific implementation details of these functions.

    It allows us to focus on the design of the presentation, rather than on the implementation of the details. That is, we can do this by declaring several abstract methods in the interface, superficially the importance of these methods, and the details of the content of the method body with the classes that implement the interface.

    The core idea of programming with interfaces is to use interfaces, that is, interface variables store references to objects that implement the class that implements the interface, so that interface variables can be implemented by the class of interface methods.

    In contrast to normal classes, abstract classes can have either abstract methods or non-abstract methods. Abstract methods are only allowed to be declared, not implemented, and a method cannot be decorated with both final and abstract.

    An abstract class cannot create an object with the new operator: if a non-abstract class is a child of an abstract class, then it must override the abstract method of the parent class and give the method body, that is, the abstract method must be redeclared in the subclass, but the abstract decoration must be removed, and the declared method name, return type, number of parameters, and type must be exactly the same as the abstract method of the parent class. That's why it's not allowed to use final and abstract to decorate a method at the same time.

    Do transformation objects: abstract classes can also do without abstract methods; If an abstract class is a child of another abstract class, it can override the abstract method of its parent class, or it can inherit this abstract method.

    Comparison of abstract classes with interfaces.

    1. Both can have an abstract approach.

    2. There can only be constants in the interface, not variables; Abstract classes, on the other hand, can have both constants and variables.

    3. There can also be non-abstract methods in the abstract class, but the interface cannot.

  3. Anonymous users2024-02-09

    Abstract Chinese meaning abstract. There are different tense forms and different meanings in sentences. When used as an adjective, it means "abstract; abstract".

    As a noun, it means "abstract; Abstraction". When used as a verb, it means "to summarize; Extract; Visualization in random inspections; Quit; Transfer".

    The abstract definitions and usage failures are as follows:

    1. Make adjectives (adj.).) means "to draw the cultivation of the elephant; abstract".

    this painting belongs to the abstract school。

    This painting belongs to the abstract paintings.

    2. As a noun (n.).It means "summary; Abstraction".

    money is an abstract thing for her. she never thinks about it.

    Money is an abstract thing to her, and she never thinks about it.

    3. As a verb (v.).) means "summary; Extract; Abstraction; Quit; Transfer".

    a licence to abstract water from the river axe.

    Permit to pump water from the Akers River.

    Third person singular: abstracts. Plural: abstracts. Now participle: abstracting. Past tense: abstracted.

  4. Anonymous users2024-02-08

    Abstract Chinese meaning abstract. There are different tense forms and different meanings in sentences. When used as an adjective, it means "abstract; abstract".

    As a noun, it means "abstract; Abstraction". When used as a verb, it means "to summarize; Extract; Abstraction; Quit; Transfer".

    The abstract definition and usage are as follows:

    1. Make adjectives (adj.).) means "abstract; abstract".

    this painting belongs to the abstract school。

    This painting belongs to the abstract paintings.

    2. As a noun (n.).It means "summary; Abstraction".

    money is an abstract thing for her. she never thinks about it.

    Money is an abstract thing to her, and she never thinks about it.

    3. As a verb (v.).) means "summary; Extract; Abstraction; Quit; Transfer".

    a licence to abstract water from the river axe.

    Permit to pump water from the Akers River.

    Third person singular: abstracts. Plural: abstracts. Now participle: abstracting. Past tense: abstracted.

  5. Anonymous users2024-02-07

    abstract modifiers, which can be used to modify classes and methods.

    1. Abstract modifies the class, which will make this class an abstract class, which will not be able to generate object instances, but can be used as a type declared by an object variable, that is, a compile-time type.

    2. The abstract modification method will make this method an abstract method, that is, there is only a declaration (definition) and no implementation, and the implementation part is based on";"In lieu of. Subclass inheritance implementation (override) is required.

    Note: A class with an abstract method must be an abstract class. However, abstract classes don't have to be all abstract methods, but they can all be concrete methods.

    The abstract modifier must be placed before the class name when decorating a class.

    The abstract decorating method requires its subclasses to override (implement) the method. When called, a method overridden (implemented) by a subclass can be called polymorphically, i.e. an abstract method must be implemented in its subclass, unless the subclass itself is also an abstract class.

    Note: The parent class is an abstract class, in which there are abstract methods, then the child class inherits from the parent class, and all the abstract methods in the parent class are implemented (overwritten), the child class has the ability to create instances of the object, otherwise the child class must also be an abstract class. There can be a constructor in an abstract class, which is the constructor of the parent class (abstract class) that the subclass needs to call when constructing the subclass object.

    As a simple example, there's an abstract class below.

    abstract class e

    Then other classes inherit from it, usually in order to implement the methods inside it.

    class f extends e

    Finally, if you define a parent class reference in the main method to point to a child class object, polymorphism will occur, for example.

    e e=new f();

    The show() method in the subclass is actually called.

  6. Anonymous users2024-02-06

    Abstract classes can only be used as parent classes, not instantiated. Define the role of an abstract class: abstract the common points of this class of objects into abstract concepts that represent the common characteristics of the class, and then only add differences when describing an object.

  7. Anonymous users2024-02-05

    It's pretty much the same as the interface. It's just that compared to an interface, it can have a specific implementation method, but it can't inherit multiple times.

  8. Anonymous users2024-02-04

    The class decorated by abstract is an abstract class, which is no different from a normal class except that it cannot instantiate objects with new.

    There can be static members (static methods, static variables) general members, constructors, can be inherited, and there can also be methods modified by abstract, pay special attention to the party that contains abstract modification in the class, and the method can only be the abstract class.

    In contrast to interfaces, which are single-inherited, interfaces are multi-implementation.

  9. Anonymous users2024-02-03

    abstract is the same as an interface class.

    It's just that the methods in the interface class must all be implemented.

    The methods in the abstract class can be implemented without implementing all of them.

  10. Anonymous users2024-02-02

    Abstract Chinese meaning abstract. There are different tense forms and different meanings in sentences. When used as an adjective, it means "abstract; abstract".

    As a noun, it means "abstract; Abstraction". When used as a verb, it means "to summarize; Extract; Abstraction; Quit; Transfer".

    The abstract definition and usage are as follows:

    1. Make adjectives (adj.).) means "abstract; abstract".

    this painting belongs to the abstract school。

    This painting belongs to the abstract paintings.

    2. As a noun (n.).It means "summary; Abstraction".

    money is an abstract thing for her. she never thinks about it.

    Money is an abstract thing to her, and she never thinks about it.

    3. As a verb defeat (v.).) means "summary; Extract; Abstraction; Quit; Transfer".

    a licence to abstract water from the river axe.

    Permission to pump water from the Akers River.

    Third person singular: abstracts. Plural: abstracts. Now participle: abstracting. Past tense: abstracted.

Related questions
8 answers2024-05-20

No. You can buy it at your place of residence, or you can buy a car from another place. But you have to do your homework when buying a car in a different place. >>>More

26 answers2024-05-20

What can you do at home?

How do you feel today? >>>More

4 answers2024-05-20

No problem. As long as the information on the ID card in your hand is consistent with the information you handed in when you learn to drive, because in some places, you need to see the ID card when you get a driver's license. >>>More

14 answers2024-05-20

Article 16 Contest Time.

The competition can be divided into: >>>More

9 answers2024-05-20

Hello, accountant Zheng Diantong online school your questions: >>>More