Java Foundation Work7

Source: Internet
Author: User

# # #07.01_ Object-Oriented (construction method constructor Overview and format) (master)
* A: Overview and role of construction methods
* Initialize the object's data (properties)
* B: Construction method Format features
* A: The method name is the same as the class name (the size should also match the class name)
* B: No return value type, not even void
* C: No specific return value returned;

# # #07.02_ Object-oriented (overloading of construction methods and considerations) (Master)
* A: Case Presentation
* Overloading of construction methods
* Overloaded: Method name is the same, regardless of return value type (construction method has no return value), only see parameter list
* B: Construction Method considerations
* A: If we do not give a construction method, the system will automatically provide a non-parametric construction method.
* B: If we give a construction method, the system will no longer provide a default parameterless construction method.
* Note: This time, if we still want to use the method of non-parametric construction, we must give it ourselves. It is recommended that you always give the method of non-parametric construction

# # #07.03_ Object-oriented (the difference between two ways to assign a value to a member variable)
* A:SETXXX () method
* Modify Attribute values
* B: Construction method
* Initialize the properties in the object

# # #07.04_ Object-oriented (code and test of Student Class) (master)
* A: Case Presentation
* Student class:
* Member variables:
* Name,age
* Construction Method:
* No reference, with two parameters
* Member Method:
* GETXXX ()/setxxx ()
* Show (): Outputs all member variable values for this class
* B: Assign a value to the member variable:
* A:SETXXX () method
* B: Construction method

* C: How to Output member variable values:
* A: Get and then stitch through GetXXX () respectively
* B: done by calling the show () method

# # #07.05_ Object-oriented (code and test of mobile phone Class) (master)
* A: Case Presentation
* Imitate the Student class, complete the phone class code

# # #07.06_ Object-oriented (steps to create an object) (master)
* A: Drawing Demo
* Drawing illustrates what happens to an object's creation process?
* Student s = new Student ();
* 1,student.class loaded into memory
* 2, declare a student type reference s
* 3, create objects in heap memory,
* 4, default initialization value for property in Object
* 5, attribute is displayed and initialized
* 6, constructs the method into the stack, assigns the value to the attribute in the object, constructs the method the bomb stack
* 7, assign the object's address value to s

# # #07.07_ Object-oriented (rectangular case practice) (master)
* A: Case Presentation
Needs
* Define a rectangular class that defines the method for calculating perimeter and area,
* Then define a test class to test.

# # #07.08_ Object-oriented (employee class case exercise) (master)
* A: Case Presentation
* Requirements: Define an employee class employee
* Analyze several members yourself and then give the member variables
* Name Name, work number ID, payroll salary
* Construction method,
* NULL and parametric
* GETXXX () setxxx () method,
* and a method for displaying all member information. and tested.
* Work

# # #07.09_ Object-oriented (static keyword and memory graph) (learn)
* A: Case Presentation
* Introduce the Static keyword through a case.
* Human: person. Everyone has a nationality, China.

* B: Drawing Demo
* Memory diagram with static

# # #07.10_ Object-oriented (features of the static keyword) (master)
* Features of A:static keywords
* A: Loaded with the load of the class
* B: Precedence over object existence
* C: Shared by all objects of the class
* Example: Students in our class should share the same class number.
* In fact, this feature is also telling us when to use static?
* If a member variable is shared by all objects, it should be defined as static.
For example
* Water dispenser (with static modification)
* Water Cup (cannot be modified by static)
* Common use static, non-static characteristics
* D: Can be called by the class name
* In fact, it can also be called by the object name itself.
* Calling with class name is recommended.
* Content that is statically modified is generally referred to as: Class-related, Class-member
* B: Case Demo
* Features of the static keyword


# # #07.11_ Object-oriented (static considerations) (Master)
* A:static Precautions
* A: There is no this keyword in the static method
* How to understand it?
* Static is loaded as the class loads, and this is present as the object is created.
* Static than object exists first.
* B: Static methods can only access static member variables and static member methods
* Static method:
* Member variables: Only static variables can be accessed
* Member method: Only static member methods can be accessed
* Non-static method:
* Member variable: can be static or non-static
* Member method: However, it is a static member method, or it can be a non-static member method.
* Easy to remember:
* Static can only be accessed statically.
* B: Case Demo
* Static Considerations

# # #07.12_ Object-oriented (the difference between static variables and member variables) (master)
* A static variable is also called a class variable member variable also called an object variable
* A: Belong to different
* Static variables belong to classes, so they are also referred to as class variables
* Member variables belong to an object, so also known as instance variables (object variables)
* B: Different locations in memory
* Static variables are stored in the static area of the method area
* Member variables are stored in heap memory
* C: Memory occurrence time is different
* Static variables are loaded as the class is loaded and disappear as the class disappears
* Member variables exist as the object is created and disappear as the object disappears
* D: Call different
* Static variables can be called through the class name, or through object invocation
* Member variables can only be called by object name

# # #07.13_ Object-oriented (the format of the main method is explained in detail) (learn)
* A: Format
* public static void Main (string[] args) {}
* B: Explanation of the format
* Public is called by the JVM and the access permissions are large enough.
* Static is called by the JVM without creating objects, direct class name access
* Void is called by the JVM and does not need to return a value to the JVM
* Main a generic name, although not a keyword, but is recognized by the JVM
* string[] args was previously used to receive keyboard input
* C: Demo case
* Receive keyboards such as data via args

# # #07.14_ Object-oriented (use static in tool Class) (Learn)
* A: Make a tool class
* Arraytool
* 1, gets the maximum value
* 2, the traversal of the array
* 3, inverse of the array

# # #07.15_ Object-oriented (instructions making process) (learn)
* A: Add documentation comments to the tool class
* B: Generate instructions via Javadoc command
* @author (extract author content)
* @version (extract version content)
* javadoc-d The specified file directory-author-version Arraytool.java
* @param parameter name//variable name of form parameter @return function runs out of returned data

# # #07.16_ Object-oriented (how to use the Help documentation provided by the JDK) (learn)
* A: Locate the document, open the document
* B: Click on the display, find the index, the input box appears
* C: You should know who you're looking for? Example: Scanner
* D: Look at the structure of this class (requires no guide package)
* Member Variable Fields
* Constructing method of construction method
* Member Method method

# # #07.17_ Object Oriented (learn the random number function of math Class) (Learn)
* Open the Help documentation provided by the JDK to learn
* A:math class overview
* class contains methods for performing basic mathematical operations
* B:math class Features
* Because the math class is under the Java.lang Package, no guide package is required.
* Because its members are all static, the constructor method is private.
* C: Method of obtaining random numbers
* public static Double Random (): Returns a double with a positive number that is greater than or equal to 0.0 and less than 1.0.
* D: I want to get a random number between 1-100, swollen?
* int number = (int) (Math.random () *100) +1;

# # #07.18_ Object-oriented (guess digital mini-game case) (learn)
* A: Case Presentation
* Need: Guess number games (data between 1-100)

# # #07.19_DAY07 Summary
Summarize today's knowledge points once again.

Java Foundation Work7

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.