• To find a rectangular area with a long and wide setting
public class recarea{
static intarea (int a,int b) {
int s;
s = A * b;
return s;
}
public static void Main (String[]arg) {
int result,x = 5,y = 6;
Result =area (x, y);
SYSTEM.OUT.PRINTLN (result);
}
}
The knowledge points learned today
• The main () method is the entry point of the program. (The formal parameter/method class needs to be the same as the return type?) )
• The execution procedure is to pass the argument to the parameter and then execute the method, which executes at the end of the statement that invokes the method after the method is run.
• Using the final life constant, the constant name is generally capitalized.
• One class multiple methods use-class constant static final setting, the definition of a class constant is outside the main method, so you can achieve the effect that different methods of a class can use, and if a constant is declared public, the method of other classes can also use this constant.
• variables, identifiers, and keywords.
Java Learning (iii)