Five elements of a successful object-oriented language
1.1 above the main two points to note, the first is the discussion object, is actually the discussion of the relationship between classes, mainly including the relationship between classes, visibility, referential relationships. When creating an instance of a class as an
JAVA basics: use Java to start Object-Oriented Programming-general Linux technology-Linux programming and kernel information. For more information, see the following. Are you switching from traditional procedural
attributes of the person class, define the name of this attribute we can write asString name;People have activities, such as talking, talking this behavior is the method in the above statement, the definition of a conversation this method can be written asvoid Talk () {method Body}The method body is the specific execution process that describes the behavior of the conversation. Ii. Creation of objects The person class is created so that we can use it to create an
conditionstestException,We add a use case to test the boundary condition testBoundary ,How to get JUnit gree bar out and try it out, such as:Regardless of TDD, writing high-quality test cases is the most important, how to do unit testing, you can refer to the "Unit test of the road" this book. In addition, "Agile Java Chinese version" shows how to integrate Java
must have a unique formal parameter list to distinguish it from other constructors.When you create a new object, Object Nn=new object (), where parentheses are called constructors.If we write a class, but no constructors are added to the class, the compiler adds a default parameterless constructor to the class. When an objec
product code)
Write the Product Code
Test Pass
Refactor the code and ensure the test passes (refactoring the next lab session)
Cycle through the development of all functions
Based on TDD, we don't have an over-design situation where the requirements are expressed through test cases, and we just 产品代码 let the test pass. There is a unit test tool JUnit in Java to aid TDD, and we use TDD to rewrite the example of the previous percent
classJava is a fully object-oriented programming language. All of his property types and methods are encapsulated in classes, Java inherits a bit of C + +, but discards those vague, complex, and error-prone features. The object-oriented
conditionstestException,We add a use case to test the boundary condition testBoundary ,How to get JUnit gree bar out and try it out, such as:Regardless of TDD, writing high-quality test cases is the most important, how to do unit testing, you can refer to the "Unit test of the road" this book. In addition, "Agile Java Chinese version" shows how to integrate Java
Java Lab Report II: Java Object-oriented programming20135315 Song NingExperimental requirements:1. Initial mastery of unit testing and TDD2. Understand and master the object-oriented three elements: encapsulation, inheritance, pol
read the name "# # #" (three #), the city name entered the end, # # #并不是一个城市的名字. If the number of city names to be read is n.Then you will read an integer matrix of nxn. Each number in the first row represents the mileage between the first city in the list of cities and the other city in turn. The mileage between the same city in the table is 0.Finally, you will read the names of two cities.Output format:Output the distance between the two cities.Input Sample:HagzouHugzoujigxng # # # 01108708 1
Recently, read the Sun Weichen teacher's "Java Object-oriented programming" a book, the heart quite a bit of sentiment, thinking to record it down.Modifiers in JavaIn the Java language, there are some words (more accurately, it sh
"abstract Method" in Java is equivalent to the pure virtual function in C ++.
13. constructors do not have multi-state rows (they are actuallyStatic Method, But the static statement is implicit ).
14. If a dynamic binding method is called within the constructor, the member manipulated by the called method may not be initialized (It may cause some difficult-to-discover hidden errors.). Example:
Class glyph {void draw () {system. out. println ("glyph
.
05. Object oriented (making of help documentation)
The Java specification is done through documentation comments.Format:/**Feature Description Statement@author author@version version@param parameters@return return value*/Each class and a member function that is normally decorated with public is annotated with a document annotation.
To generate a document for
of all functions
Writing and debugging results of TDD mode test code(ii) Object-oriented three elements (1) abstractAbstract ability refers to the ability of "refine, simplifying, Youbiaojili, and seeking for the same in different". In program design, abstraction consists of two aspects, one is process abstraction and the other is data abstraction.(2) encapsulation, inheritance and polymorphismThe thr
), and object-oriented programming (OOP). OOA decomposes The system according to the abstract key problem domain and focuses on what. Ood is an object-oriented implementation of the symbolic design system, which constructs the system into a "real-world"
201771010114 Li Xiaoying "Object-oriented programming (java)" First week study summaryPart I: Course preparation sectionFill in the Course Learning Platform Registration account,
Platform Name
Registered Account
Blog Park: www.cnblogs.com
https://www.cnblogs.com/li-xiaojing/
) {this.minute.increase (); if (this.minute.getValue () = = 0) { This.hour.increase ();}}} Public String toString () {//returns a strThe value of ING, in the form of "Hh:mm:ss", representing the current time. Each of these values occupies two bits, which is less than two 0. such as "00:01:22". Note that the colon is in Latin, not Chinese. Return String.Format ("%02d:%02d:%02d", This.hour.getValue (), This.minute.getValue (), This.second.getValue ());// Tip: String.Format () can format a string i
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.