Here are some of the lessons I summarized in the previous lesson and the code is most of the teacher's notes personally think is very good, but also a more classic content, sincere hope that these for those who want to learn some help!
Because the code is sub-module upload is very inconvenient. Also more, speak of is more clear! If you need to be able to leave your email in the comments I see will be sent to you for free! Thank you for this platform let us all progress together!! Remember that the programmer is selfless!!!
Also very welcome to my blog to watch the blog address: http://www.cnblogs.com/duscl/
/*1: How to create a Help document (learn) (1) Write a Class (2) Add a document note (3) Generate from the Javadoc tool javadoc-d catalog-author-version ARRAYTOOL.JAVA2: Available through the JDK API learned the Math Class (mastering) (1) API (application programming Interface) application programming Interface (Help document) (2) How to use it? Please refer to day08\code\02_ How to use the Help document provided by the JDK \ How to use the Help document. txt (3) Math class A: Is the class B that operates on mathematics: there is no constructor because its members are static C: Generate random number public static double random (): [0.0,1.0) D: How to produce a random number between 1-100 int # = (int) (Ma Th.random () *100) +1; E: Guess number Games 3: code block (Understanding) (1) code enclosed in {}. (2) Classification: A: Local code blocks are used to limit the life cycle of variables, release early, and improve memory utilization. B: Construct blocks of code to put the same code in multiple construction methods here, before each construction method executes, first executes the construction code block. C: Static code blocks initialize the data of the class, only once. (3) Static code block, construct code block, construct method order problem? Static code block > construct code block > Construct Method 4: Inherit (Master) (1) Extract the same members from multiple classes into a separate class. Then let these multiple classes have a relationship with that independent class, and these classes will have the content. This relationship is called inheritance. (2) How is inheritance represented in Java? what is the format? A: Using keyword extends to represent B: Format: Class subclass name extends parent class name {} (3) Inheritance benefits: A: Improved code reusability B: Improved code maintainability C: Let the class and class have a relationship, is the precondition of polymorphism (4) The disadvantage of inheritance: A: Let the coupling of the class enhance. Such a change in a class will affect other classes related to that class. Principle: Low coupling, high cohesion. Coupling: A class-To-class relationship: the ability to accomplish something by itself B: Breaking the Encapsulation (5) Inheritance in Java A:java class only supports single-inheritance B:java can be multi-layered (inheritance system) (6) Considerations of Inheritance: A: Subclasses cannot inherit private members of the parent class B: Subclasses cannot inherit the constructor of the parent class, but can access the C by super: Do not inherit for some functions (7) When to use inheritance? A: Inheritance embodies: is a relationship. B: Adoption of the Assumption Method (8) The membership in Java inheritance A: member variable A: the member variable name of the subclass and the member variable name in the parent class is not the same, this is too simple B: the member variable name of the subclass and the member variable name in the parent class, this How to access it? The subclass's method accesses the lookup order of the variable: the local scope of the subclass method is found, and is used. In the subclass of the member scope to find, there is the use. In the member scope of the parent class, it is used. If you can't find it, you'll get an error. B: Construction Method A: The construction method of a subclass the default is to access the parent class's parameterless constructor method is for subclasses to access the initialization of the parent class data B: If there is no parameterless constructor in the parent class, what should I do? Subclasses use super to explicitly invoke the other constructs of the parameter constructor subclass through this call itself, but there must be a construct that accesses the parent class to give the parent class A non-parametric construct C: Member Method A: The member method of the subclass is not the same as the member method name in the parent class, this is too simple B: the member method of the subclass and the member method in the parent className, how does this visit? To access the lookup order of a method by a subclass object: In the subclass, there is the use in the parent class to find, there is no use found, on the error (9) Two face questions: The difference between A:override and overload? Can overload change the return value type? What are the differences between B:this and super and their respective roles? (10) The data initialization of the face question a: the initialization process of a class B: the construction of the child parent class C: Hierarchical initialization (11) Case: A: Before the student and teacher case inheritance Post-inheritance B: analysis and implementation of cat and dog cases *\
Java Fundamentals (eight) object-oriented (iii)