Java Learning Notes (i)

Source: Internet
Author: User

I. Java rules: Static variables i.e. class variables (differences and instance variables) are accessed using a class method that is a static method
Example: public class Object_1
{
static int i=1;
Static
{
Static zone blocks, executed only once, when a class is defined, execution is completed in the Code area definition
System.out.println ("one");
i++;
}
Public object_1 ()
{
System.out.println ("both");
i++;
}
}

two. Java object-oriented programming-four features
1. Abstraction
2. Encapsulation: Public (open), protected (subclass and same package), default (same package), private (proprietary)
3. Inheritance: Extends (inheriting public,protected)
4. polymorphic
three. Polymorphic
1. Overloading {
Method name is the same
Method ofparameter type, number, order at leastThere's a different one.
Method return type can be different
Method modifiers can be different
cannot be overloaded if only the return type is different
cannot make an overload if only the access modifier is different
}
2. Method overrides (subclass with same name method overrides parent class method)

Java Learning Notes (i)

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.