Java Beginner Notes

Source: Internet
Author: User

1. The method of generating a random number (0~9) is as follows: int random = (int) (Math.random () *10)

2.switch () Note the value of the expression in parentheses after the break and if of the nested application must be integer or character type

3.while () The condition in parentheses is to judge true and False, Do-while () parentheses with a Boolean type convenient to understand

4.for loops, Nested loops

5. The break in the loop jumps out of the statement after the execution loop of the loop, which is often used in switch; Continue out the remaining statements in the loop body and executes the next loop, often in the loop structure

6. Array: Declare, allocate space, assign value, process data.

notation, such as int score[],score=new score[5]

int score [] =new int[5],int score[]={},3 Common wording

Score[i]=input.nextint (), note the parentheses!

Score.length array length.

Arrays.sort (score); array in ascending order.

Java Beginner Notes

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.