Non-parametric method of class
Two main characteristics of an object:
Properties and Methods
Method:
The access modifier method returns a value type method name () {
//main body of the method
}
No parameter method:
has a return value:
For example:Public String Play () {
//return value type and method return value type consistency
return "hehe";
}
no return value:
For example:public void Play () {
}
with the parameter method:
Allows mutual invocation between methods
member variables and local variables:
A member variable refers to a variable in a class//Can be used anywhere in the class! Java will give the member variable an initial value
A local variable refers to a variable in a method//can only be used inside the method, out of the way is not in! Java does not give initial values to local variables
Note:
Local variables have higher precedence in the same class when the member variable and local variable have the same name
Javadoc:
Non-parametric method of class