Structured programming and object-oriented;
The characteristics of an object are called attributes;
A class is an abstraction of an object that is the real column of a class;
The declaration of the package must be the first executable statement in the source file
Named with an inverted organization domain name.
The program is not executed around the task to be solved, but is resolved around the object in question to be solved, and each property of the object is represented as a member variable in the class.
Method One: Public String tosting () {//access modifier return value type, method name ([parameter list])
Return "" + variable name +;//method body--The function code block to be implemented
public String name;//Name
Public String sex;//Name
public int age;//Name
Public String suno;//Name
}
Method Two: public void introduce () {
public String name;//Name
Public String sex;//Name
public int age;//Name
Public String suno;//Name
System.out.println ("");
}
int i;//local variable, no value, can only be used in his declaration to
This: String return value type only with current object
To string method name protected represents the public protected
Private: Int Default
New keyword
This reference uses packages to organize classes
The package is used as a management to prevent duplication, which can be used in different packages and must be placed in the first sentence.
Com.lovo student = new COM lovo.student ();
Behavior of the object
Breakpoint:
1. Locate (set breakpoint) 2. Start Debugging 3. Step through observation changes 4. Modify.
Method signature
public string void Main (string []args)
Columns such as: The following method signature declares two form parameters, one is an int type and one is a float type
public float DIVTE (int x,float f)
In a static method, only static members can be directly called directly, and non-static members cannot be called directly
Second, in the member method, the static member can be called directly, non-static members. No static
Static Modified method: A statically member that is shared to all objects of a class
Static member: Class name. Call
Only values are passed in Java.
Method overloading
In a class, there are two and two methods with the same name, different parameter types and different parameter numbers.
Constructors
A constructor is a special way in a class that is called to execute when a real column is created
The constructor method constructs a name that is consistent with the class.
Column: public class student{
Public student () {
}
}
Fist can only take numbers
By default, there is only one non-parametric construction method in the class
Public student () {
}
Stu.display ();
Import java.util.scanner;//Input
Scanner import= New Scanner (system.in); output
Classes, objects, packages