Earlier Java notes

Source: Internet
Author: User

Multiple if statements, even if the previous if is true, the subsequent if will continue to judge,

If you use else if it is only if the former is false, its if is then judged.

If Else statement

If a>=5 Shuchu b=10

else Shuchu c=10

There must be a situation that satisfies the above conditions,

Else if statement the former is only false before running if statement

If a=10 Shuchu b=10

else if a.10 Shuchu b=11

else Shuchu c=10


12.5


If, for after does not add ";"

";" represents an empty statement

12.7

Bubble sort

Int[] A=new int[10]
What is the outer loop (number of times)? How many times? 10-1
What is the inner loop (number)? How many times? 10-Number of trips

for (int i=1;i<=9;i++)
{
for (int j=1;j<=10-i;j++)

if (A[j]>a[j-1])
{
int temp=a[j-i];
A[J]=A[J]
A[j]=t
}


}

12.10

Object oriented first want to build a few class


The parent is constructed first to construct its own

The difference between overriding and overloading
Overloading is the same method name, with different parameters including the number of parameters and the parameter data type
Overrides are method names and parameters are different

Property (without parentheses) length
Method (with parentheses) System.out.println ()

' single quotation marks are characters

"" Double quotes as strings

12.18

Java is a single inheritance

Earlier Java 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.