Watching Java-03: Object oriented

Source: Internet
Author: User

Object 1.Java in Java, as an object-oriented language, supports the following basic concepts:
    • Polymorphic:
    • Inherited:
    • Packaging:
    • Abstract:
    • Class:
    • Object:
    • Instance:
    • Method:
    • Overload:
2. Characteristics and methods of the class
    1. 1 Construction methods: Each class has a construction method, if there is no definition displayed, the Java compiler will provide a default construction method, the object is created at least to invoke a constructor method, the constructor name must be the same as the class, a class can have more than one construction method;
    2. 2 Source file Reputation:
      ① A source file can have only one public class;
      ② A source file can have multiple non-public classes;
      The name of the ③ source file must be consistent with the public class;
      ④ if a class defines a bundle, the package statement should be in the first line of the source file;
      importThe ⑤ statement should be placed between the package statement and the definition class statement;
      The ⑥ import statement and the package statement are valid for all classes defined in the source file, and the same source file cannot give different packages the same reputation;
    3. 3 classes in Java have access levels in 4, with different types of pages, such as abstract classes, finnal classes, inner classes, anonymous classes
3. Import statement

Java, such as giving a complete qualified name, including the package name, the class name, the Java compiler will be easy to navigate to the source code or class. importThe statement is used to provide a reasonable path, so that the compiler can find a class;

Watching Java-03: Object oriented

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.