。 Some small details in Java

Source: Internet
Author: User

1.main method.

------Any Java program has a main method, which is the entry for the program.

------When the Java + Class name command is executed, the JVM loads the class, looks for the main method in the class, and then executes the entire program from the main method.

------Note: The main method is called to the JVM, and we do not call this method when we write the program.

------There is only one main function in a class.

2.public

------"Class + class name" before adding public, it is necessary to keep the class name and file name consistent.

3. A software often has two instructions, one is the software specification, the other is the user manual.

4. Comment function

------The annotation Description program.

------Debug Program.

5. Code is just a form of thought, computer language is just to express our thoughts, so we must first have ideas before programming. Write the comments before------write the code. This step is quite related to demand analysis and design.

/*

Requirements: The purpose of this piece of code

Thinking: The idea of solving the problem

1. How to Think

2. How to Think

3. How to Think

Steps: Implementation Steps

1. What code is used to implement

2. What code is used to implement

3. What code is used to implement

*/

6. Modulo operator
------expressed in%.
------that the remainder is obtained.
------For example,
int a=5;
int b=3;
int c=a%b;
Compile execution c=2
Because 5 divided by 3 results is more than 1 2.

------Another example,
int a=-5;
int b=3;
int c=a%b;
Compile execution c=-2
Because 5 divided by 3 results is-1-2.
.
------Another example
int a=5;
int b=-3;
int c=a%b;
Compile execution c=2
Because 5 divided by-3 result is-1 more than 2.

------The rule of modulus, the result of modulo is always the same as the sign of the divisor.
Dividend is 5, the result of modulo is 2.
If it is-5, then the remainder result is-2

7. String data and any data connected using "+" will eventually become a string.

------such as SYSTEM.OUT.PRINTLN ("5+6=" +5+6);

The output is------

5+6=56

8. The plus () brackets increase the priority level.

------such as SYSTEM.OUT.PRINTLN ("5+6=" + (5+6));

The output is------

5+6=11

。 Some small details in Java

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.