life cycle of an object
The creation of the object must have a constructor method.
Create object sub-declaration and allocate memory two steps.
Memory conditions:Defines a variable that does not allocate memory, and only assigns the initial value to allocate memory.Defines a local variable and assigns an initial value, at which time there is me
of the parent class, which improves the reusability of the Code;later extension and maintenance, just add the corresponding subclass. other points of knowledge related to:Super Keyword: An object that represents the parent class, invokes the properties of the parent class ,methods, construction methods. abstract Keyword: abstraction, adornment class, adornment method. static keyword: statically, decorated property, method, code block,Inner classFinal
. Inheritance Benefits: Subclasses share the code of the parent class, improving the reusability of the Code; Code later extension and maintenance, just add the corresponding subclass. Other knowledge points involved: Super Keyword: An object representing the parent class, calling the parent class's properties, methods, and construction methods. abstract Keyword: abstract, decorated class, cosmetic method. static keyword: static, cosmeti
the code of the parent class, which improves the reusability of the Code; later extension and maintenance, just add the corresponding subclass. related to other knowledge points: Super Keyword: An object representing the parent class, calling the properties of the parent class, method, construction method. abstract Keywords: abstract, decorated class, cosmetic method. static keyword: static, Decorated property, method, code block, inner c
: Subclasses share the code of the parent class, which improves the reusability of the Code;later extension and maintenance, just add the corresponding subclass. other points of knowledge related to:Super Keyword: An object that represents the parent class, calling the parent class's properties, methods, and construction methods. abstract Keyword: abstraction, adornment class, adornment method. static keyword: statically, decorated property, method, c
20145311 experiment Two "Java Object-oriented programming" program design process experiment contentDesign and implement the plural class Complex using unit Test and TDD methodWrite code:1, the first design to realize the plural class Complex, the plural class Complex method design has: the plural class definition, the
construct methods in this class that have and allow only the first line of code in the method body to appearThe variable defined in the normal (instance) method must be appended with the initial value (not giving you no error when you do not call it)If you don't give an error when you callstatic modifierYou can modify----static variable (class variable) class name on a variable. Static variable nameCan be decorated on a normal method--static method (class method) class name. static method NameC
; int fib[]=new int[m]; for(n=0;n
The code has the following problems:
The class name does not match the naming convention;
Sentence structure is not easy to read
Experiment
Three, agile development and XP practice-3 experimental content
Refer to Http://www.cnblogs.com/rocedu/p/6683948.html to complete the learning of Java cryptography related content in pairs, combining refactoring, git,
overloadsMethod overrides and method overloads have the following same points:
Requires a method with the same name.
Can be used between abstract methods and non-abstract methods.
Method overrides and method overloads have the following different points:
Method overrides require that parameter signatures must be consistent, and method overloading requires parameter signatures to be inconsistent.
Method overrides require that the return type be consistent, and the
error; implements polymorphic conditions: the existence of an inheritance, the method of overriding the parent class by a subclass, the reference variable of the parent class to the child class object;
NBSP;
Subclass is converted to a parent class (a reference to a parent class is directed to a subclass object), called an upward transformation; A class inherit
!The memory allocation diagram for this code is as follows:This is the difference between a class variable and an instance variable!Objects are created through classes, so you need to load the appropriate classes when you create the objects. A class can create multiple objects, and each object has its own entity.Difference:1. Class variables (such as classer above) allocate memory when the class loads, instance variables (such as age above) are alloca
level of the base variablesub.methodofbase ();//Legal, sub inherits the method of base's protected typeSub.methodofsub ();//legal, which is the instance method of the sub itself }}The Java language does not support multiple inheritance, meaning that a class can only inherit another class directly. The reason here is that "one class directly inherits another class" is because the class can also have more than one indirect parent class, for example,
breakpoints when debugging1. The program executes one line at a2. Important variablesBasic Data type conversions:Double---> intint--->doubleConversions of reference data types:1. Upward transformationParent class Variable name = new Subclass instance ();A. The line code can perform successfully without castingB. Creating a parent class object is exactly a subclass instanceC. The method that is called when the method executes is the overridden method o
First, the last three test cases are submitted through theSecond, study the learning StringBuffer in the way of TDD, submit the unit test case and test passThird, using [WHITESTARUML] to model the code in the experiment two, the Hair class diagram (class diagram only two fewer classes)Iv. Unit test code and running success and code-on-Cloud codes linkTask: Develop a plural class Complex in TDD, which requires the following://define properties and generate Getter,setterdouble realpart;double imag
First, the purpose of the experiment1. Initial mastery of unit testing and TDD2. Understanding and mastering the object-oriented three elements: encapsulation, inheritance, polymorphism3. Initial mastery of UML modeling4. Familiarity with S.O.L.I.D principles5. Understanding Design PatternsIi. contents of the experiment(a) Unit testingPseudo-code: independent of the specific
and has produced languages such as FORTRAN, PASCAL, and C. Structured Methods extend the analysis and design of the program to the analysis and design of the project, and combine the technical support of the programming language to generate and develop the program.
In 1980s, with the increasingly complex and huge application systems, structured development methods encountered some problems in engineering applications. During the same period, after 20
) elements are properly nested8, valid XML in addition to satisfy the XML specification, but also to meet the corresponding DTD and schema definition of the element rules; Valid XML must be well-formed, but well-formed XML is not necessarily valid.9. DOM parsing: API based on tree structure; the entire XML document must be parsed and stored in memory; The client application can access the objects randomly; large documents can cause memory tension.10. Sax provides an event-driven model for parsin
class, and the variables that inherit from the parent class are hidden.Method Rewrite principle:1. Must have an inheritance relationship2. The overridden method cannot have more restrictive access rights than the overridden method, which can be the same.3. After rewriting the weight in the method can not be specific to the method to generate more exceptions (exceptions).4. Return value, method name, method must have the same number of arguments as the parent class. (That is, only modify the con
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.