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)