5.Java method

Java method:

  • The method is an ordered combination of steps to solve a class of problems
  • The method comprising the object or class
  • The method was created in the program, was quoted elsewhere
Modifier return type method name (parameter type parameter name) { 
    ... 
    method body 
    ... 
    return a return value; 
}

 

Constructors: When an object is created, the constructor will initialize the object. The method of construction and its name in the same class, but the construction method has no return value.

finalize () method: the object is invoked garbage collector prior to recovery, to remove the object

Guess you like

Origin www.cnblogs.com/123lmliang/p/11273168.html