Java Learning (iii)

Source: Internet
Author: User

• 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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.