201671010122 2016-2017-2 "Java Programming" sixth Chapter review Summary

Source: Internet
Author: User

The Sixth chapter review summarizes

A week after a small holiday, the teacher did not want to catch up on the progress of the seventh chapter of the new knowledge, but the contents of the previous chapter of the system review, originally in the sixth chapter I left a relatively many problems, a lot of knowledge points are indefinitely, vague, but this week ended, I found that they have a great harvest.

sorting strings by dictionary and sorting by string length I am a little rusty week, do not understand, but through last week's program practice, I know:<1>string[] friends={"Petery", "aully", "Mary"};

Arrays. Sort (Friends); is sorted by dictionary and runs as follows: Aully,mary,petery.

<2>string[] friends={"Petery", "aully", "Mary"};

Arrays.sort (Friends, (First,second)->first.length ()-second.length ()); is a Sort by string length, and use the a lambda expression that runs as:petery,aully,mary. and I have a further understanding of why JAVA is referencing lambda Expressions When a program uses Lambda Expression saves the interface method, and the program becomes simpler.

Inner class Grammar point I thought it was very vague, it is not clear, now seems to be a lot of problems solved. The syntax rules for inner classes are:

[ modifier ] class outerclass{

...

[ modifier ] class innerclass{

...

}

...

}

that is, inside an outer class nested inside a class, the inner class can directly access the members of the outer class, including private members, but the members of the inner class cannot be directly accessed by the external class, the inner class is not only defined in the class, it can also be defined within the program block, A local inner class is introduced, and the local inner class can be defined in the method, even inside the for loop body. If you create only one object of the class, you do not have to name the class, and then JAVA introduces an anonymous inner class, because anonymous classes do not have constructors, instead of constructors that pass constructor parameters to the superclass, because they do not have a class name. The most conspicuous feature of an anonymous inner class is that if the enclosing parenthesis of the construction parameter is followed by a flower brace, it indicates that the anonymous inner class is being defined, and that the last curly brace is followed by a ";" End. In my opinion,JAVA refers to these things in order to make the program easier and easier for editors and readers.

this week's blog post I choose to describe the problems that have previously remained, but also feel that I will deepen the impression here again, will further understand these grammatical points. And what about it! I am also very grateful to the teacher last week for me to provide a link to the internal class syntax, thank you teacher!

201671010122 2016-2017-2 "Java Programming" sixth Chapter review Summary

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.