first, the concept :
All things are objects
Class-To-object relationships: Classes are types of objects, objects are instances of classes
Two, the object has two characteristics:
Properties: Characteristics of an object (e.g. name, gender)
Method: An action performed by an object (such as: eating, and ...). )
Third, object, package
Object: An entity used to describe an objective thing, consisting of a set of practices and methods.
Encapsulation: Encapsulating properties and methods into an object
Pros: Hide its internal details without revealing external details
IV. specification of class names in Java
1. Capitalize the first letter of the class
2. The class name cannot use the Java keyword
3. Cannot contain other characters except the "_" and "$" symbols
4. Cannot contain numbers and Chinese characters
※ class is the object of class, all classes are subclasses of object
※java is an object-oriented language
V. Definition of Class
Access modifier Class class name {
Access modifier data Type property name;
The access modifier method returns a value type method name () {
}
}
Vi. invocation of properties and methods in a class
Use the object name "." Make a call (make sure the object has been created)
For example:
Student stu=new Student ();
Stu.name= "Zhang San";
Class and Object focus