Abstract methods and abstract classes Abstract methods and abstract classes must be modified using abstract. classes with abstract methods can only be defined as abstract classes. abstract classes can have no abstract methods.Rules they follow:1.
Abstract class:Classes that contain abstract methods are declared abstract classesAbstract methods are implemented by subclasses.Classes that contain abstract methods must be declared as abstract classesAbstract class Quilt class inheritance,
Final
The final decorated class, which indicates that the class cannot be inherited
The final modification method, which indicates that this method cannot be overridden
Final modifier constant (constant capitalization), indicating
1:final Keywords (master)(1) is the final meaning, can be modified class, method, variable.(2) Features:A: It modifies the class and cannot be inheritedB: It modifies the method, cannot be rewrittenC: It modifies the variable, is a constant(3)
Abstract class:1) A class that contains at least one abstract function. In other words, any class has only one or more abstract methods, and this class is an abstract class.2) There can be specific methods in an abstract class, and you can have
1 abstract class (1) Abstract methods are declared only, not implementations, and can be seen as virtual methods without implementing the body. (2) Abstract classes cannot be instantiated (3) Abstract classes can, but do not have to have
Ⅰ. Abstract class1. Abstract classes, abstract methodsAbstract class: Typically, there are abstract methods in it, and the class is preceded by a definition of an abstractAbstract method: Defines only the name of the method and does not define the
final ——— finally. As a modifier
Can modify classes, functions, variables;
A class that is final modified cannot be inherited;
The final modified method cannot be rewritten;
A final modified variable can only be assigned once,
OverloadReload: Overload, Reloaded. In object-oriented, overloading refers to a function (method) that has a different return value or a list of arguments, and can have different forms of existence (allowing a function with the same name to exist:
Final is primarily used to modify classes, methods, and propertiesWhen used to decorate a class, the class cannot inherit from the quilt class, in other words, the class has no subclassesThis method cannot be replicated when used in a modified
Function of class 1 instantiate object 2 as the basic class of other classes, inherited! 3. Role of calling its static member class
1. instantiate an object
2. it is inherited as the base class of other classes!
3. call its static members
Two main
Abstract classAn abstract class that appears only for inheritance, does not define specific content, and only defines what it is.Only abstract methods are placed in general abstract classes, only the return type and parameters are specifiedLike what:
This article transferred from: http://blog.csdn.net/fanteathy/article/details/7309966Difference:1, the use of the interface is through the keyword implements. The use of abstract classes is through the keyword extends. Of course the interface can
Abstract class and interface, abstract class Interface
Abstract classConcept: Class modified by abstract keywordsMember features:Constructor: YesMember variables: no restriction, both constant and variableMember method: there are no restrictions,
Abstract class _ interface _ polymorphism Abstract keywords indicate Abstract classes. They can modify a class or method. If it is used to modify a class, this class is an abstract class. If it is used to modify a method, this method is an abstract
Java ~ Class, abstract class and interface, java Abstract class Interface
Recently, I was fascinated by the world of java, hoping to refactor my lind to a java version. Although I encountered some minor problems, I also solved them,Knowledge needs
1.1 Variable parameters of the methodAfter JDK1.5, the number of parameters can vary when defining a methodSyntax: Add 3 points after the last data typeAttention:1. The variable parameter can only be at the end of the parameter list;2. A method can
1. Java virtual functionsThe existence of virtual functions is for polymorphism.C + + the normal member function plus Virtual The keyword becomes a virtual functionjava c++ java java final keyword becomes non-virtual function PS:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.