Java BASICS (6) Object-oriented (1) and java basics object-oriented

Source: Internet
Author: User

Java BASICS (6) Object-oriented (1) and java basics object-oriented

Here are some of the knowledge points and code I summarized in my previous class. Most of the notes I think are very good and classic, sincerely hope that these will help those who want to learn!

It is inconvenient to upload code by module. There are also many things, and they are also clear! If you need it, you can leave your email in the comments. I will certainly send it to you for free! Thank you for making progress on this platform !! Remember that programmers are selfless !!!

Also very welcome to my blog to watch blog address: http://www.cnblogs.com/duscl/

 

/* Object-oriented (GRASP) (1) Object-oriented object-oriented is A process-oriented programming approach (2) Object-oriented thinking features: b: simplify complicated things C: Let's change from Executor to conductor for example: buy computers, wash clothes, and cook... everything is object (3) Put elephants in the refrigerator (understanding) A: process-oriented implementation B: object-oriented implementation Note: how can we make our operations more in line with object-oriented thinking? A: What types of B are there: which members of each class C: Relationship between classes and classes (4) Relationship between classes and objects: the basic description of things in the real world B: the most basic unit in Java is class. Therefore, we need to use classes to reflect things C: class member variables things attributes member Methods things behavior D: Class: a set of related attributes and behaviors. Is an abstract concept. Object: a specific instance of this type of thing. (Object) Example: Student: class leader: Object (5) class definition and use A: class definition member variable definition format is the same as before, that is, the location is different. In the class, method. The format of the member method definition is the same as before, that is, static is removed. B: Use the class content a: Create an object? Format class name object name = new Class Name (); B: How to Use member variables and member methods? Object Name. name of the member variable object. member method () (6) Case study: A: Student class definition and use B: Mobile Phone class definition and use (7) memory Diagram A: Memory Diagram B of an object: memory diagram C of two objects: Memory diagram of three objects (8) development, design, and feature A of Java programs: Development: Constantly creating objects, through object calling function B: Design: it is to manage and maintain the relationship between objects C: feature a: encapsulate B: Inherit c: Polymorphism

/* 1: differences between member variables and local variables (understanding) (1) location in the class different member variables: local variables outside the class method: method definition or method declaration (2) location in memory different member variables: local variables in the heap: (3) different member variables in the stack: as the object is created, the local variable disappears as the object disappears: as the method is called, the local variable disappears as the method is called (4) different member variables with different initialization values: there is a default local variable: There is no default value, it must be defined, assigned a value, and then can use 2: class as a formal parameter problem? (Understanding) (1) if you see that the parameter required by a method is a class name, you should know that what you actually need here is a specific object. 3: anonymous object (comprehension) (1) objects without names (2) Application Scenario A: call A method only once. B: It can be passed as an actual parameter. 4: encapsulation (understanding) (1) hiding Implementation Details and providing public access methods (2) Benefits: A: Hiding Implementation Details and providing public access methods B: improve code reusability C: improve code security (3) Design Principles hide implementation details that do not want to be known by the outside world and provide public access methods (4) private is an embodiment of encapsulation. Encapsulation: Class, method, private modifier member variable *\
 

 



*\

 

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.