Notes on basic object-oriented knowledge in java

Source: Internet
Author: User

1. Enumeration classes cannot create objects freely. objects are fixed when defining classes.
2. Packaging of Basic Data Types
3. constructor, common initialization block, and static initialization Block
4. initialize a class. All its parent classes will be initialized.
5. Structure Relationship of the class: General> special> whole> part (the class contains the reference of another object)
6. static modified members cannot access members without static modification.
7. No constructor is written. Use the default constructor.
8. Class modifiers: public, final, and abstract
9. field modifier: --> public, protected, and private (one of them)
--> Static (the modified member belongs to the class)
--> Final
10. Method modifier: --> public, protected, and private (one of them)
--> Abstract and final (one of them)
--> Static (modified members belong to instances)
11. Class Members: feild, method, internal class, and initialization Block
12. constructor modifier: --> public, protected, and private (one of them)
No return type or return
13. static modified feild and methods can be called through classes or instances.
14. arrays and classes are reference data types.
15. Assign null values to all referenced variables. java will automatically release the memory.
16. Reference variables exist in the stack (encapsulation of pointers) and objects exist in the heap.
17. this is the reference variable pointing to the calling object in the constructor or method.
18. java allows you to directly call other methods in the same object without using this.
19. To call another normal method in the static method, only one object (such as new aaa.info () can be re-created. After the method is called, no reference points to this object and is recycled, use only once), cannot use this, because the static method belongs to the class method, does not belong to the object, so it cannot depend on the referenced variable (same as 6th)
20. this can be used as the return value of the method.
21. parameter passing in java is both value passing and reference is the same
22. The static method can call the static method in the same class.
23. variable parameters are equivalent to arrays. Three points must be added after the last parameter type.
24. recursion is performed in a known direction.
25. Method overloading: Different Parameters
26. If you want to call a variable-length method for an overload parameter, You can input parameters in array format, but it is not recommended.
27. member variables (including class variables and instance variables) do not need to be explicitly initialized; local variables are not required; local variables must be initialized for methods and code blocks; otherwise, local variables cannot be used.
28. Names between member variables and between local variables cannot be duplicated. member variables and local variables can be duplicated.
29. package, import, and import static
30. classes of the same package can be located in different locations, as long as they are marked with a package, and the class must be in the corresponding directory
31. Access Controller: private: similar; default: Same package; protected: subclass of different packages; public: All
32. The external class only has default and public

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.