Instructions and parameter arguments
Formal parameters : an inlet for use in the method herein, is defined as a variable parameter referred to as a method of entry variables.
Argument variables : the variables we defined earlier in the method is a kind of argument variables.
Description :
- Argument range of action is to start from the definition of '}'
- The scope parameter is defined from the start until the end of the method for performing the method.
- Generally variable argument parameter values can be transmitted to the process.
- Argument variables typically requires the initial value, but not the variable parameter to the original value.
public class MethodDemo {
public static void main(String[] args) {
int age = 23 ; // 实参
System.out.println(age);
int a = 10 ; // 实参
int b = 20 ; // 实参
sum(a, b);
}
// int a , int b 是形参
public static void sum(int a , int b ){
int c = a + b ; // c是实参!
System.out.println(c);
}
}