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 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 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 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