201671010138 2016-2017-2 "Java Programming learning experience"

Source: Internet
Author: User

this week is still learning about interfaces, but learning lambda expressions makes blocks of code more concise.

Lambda form -up is essentially an anonymous method. As the following example:

public int Add (int x, int y) {

return x + y; }

This looks like this after turning into a lambda expression: (int x, int y), x + y;

Parameter types can also be omitted, and the Java compiler is inferred from the context:

(x, y), x + y; Returns the sum of two numbers

or (x, y), {return x + y;}//explicitly indicate the return value

A visible lambda expression consists of three parts: A parameter list, an arrow (-), and an expression or a block of statements.

Internal classes are also a focus of learning, inner classes are mainly members of inner class, local inner class, Anonymous inner class

and static internal classes. Inner classes can directly access members of external classes, including private members, but the inner class

Can not be accessed directly by the external class. Anonymous inner classes are the only classes that do not have constructors . It is because it has no structure

The use of anonymous internal classes is very limited, and most anonymous internal classes are used for interface callbacks. In-part

A class cannot be declared with public or private access modifiers, and its scope is limited to declaring this local

In the block.

This week the Knowledge point mastery is more solid, through the experiment unifies the knowledge point, may deepen the understanding, causes the text not only to stay

On the surface, you can understand its actual value.

201671010138 2016-2017-2 "Java Programming learning experience"

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.