Chapter 2
Object-orientedProgramDesign
Five phases of Software Development
Abstract Requirement Analysis Modeling
System design model refinement
Coding implementation
Test phase
System Maintenance
Class and object are the core concepts of object-oriented methods.
Class is the description of a class of things. It is an abstract conceptual definition.
An object is an actual entity of this type of things and thus becomes an instance.
The value of the string attribute must be enclosed in quotation marks.
Create a new object using the new Constructor
Access Object members (including attributes and methods) Using Object Name and object Member)
Users' direct operations on the data defined inside the class (Object member variables) will lead to data errors, confusion, or security problems.
Java encapsulates data and declares it as private. It then provides one or more public methods to perform operations on this attribute to achieve the following purposes:
Hide the implementation details of a class
Users can only access data by using predefined methods, which can be easily added to logical control and restrict unreasonable operations on attributes.
Class references must be instantiated and methods must be called in the class.
The package must be the first statement of the Java source file to indicate the package of the classes defined in the file. That is, to put the class file generated by this Java into a package file, use. to specify the package directory level.
To call classes of different packages, you must use the import statement to introduce the required classes.
Java. Lang
Contains core classes of the Java language, such as string math integer system thread
Provides common functions
Java. AWT contains Abstract Window toolsets. These classes are used to build graphical users.
Interface (GUI)
Java. Applet contains the classes required to run the applet.
Java.net Contains classes for performing network-related operations
Java. Io Contains classes that provide multiple input/output functions
Java. util contains some utility sets such as defining system features using functions related to date and calendar