Method overloads are only related to parameters and are not related to any other.
such as
Boolean withdraw (double money) {}
int withdraw (int money) {}
The difference between overrides and overloads:
There are two method names in the same class, but the parameters are different, which is called overloading.
A class of two inheritance relationships, with a method in a subclass like the parent class, which is called overriding.
Overriding: Subclasses inherit the parent class method and override this method. (method name, number of arguments, type unchanged)
Overloading: Multiple methods have the same name, but their parameters vary in number, type, and order
Statically static keywords, mainly with this keyword, the program can be called directly with the class name, without the keyword static must create an object, must be referenced by the object.
Note that the main function, main must have a keyword static, or the program just start not run, the program is not running even more depicting is to create an object, so this is a key point to pay attention to.
The static modified method can not occur overriding, but the static modification method has the following characteristics:
The parent class and subclass can have two methods with the same name and signature, but with different contents. In subclasses, methods of the parent class are hidden by methods of the quilt class.
A static method in a hidden parent class cannot be accessed from a subclass.
The static adornment method can be inherited from the subclass, but after executing the upcasting, there is no dynamic binding behavior.
Array Expansion:
if (size>=accounts.length) {
Expend ();
}
private void expend () {
account[] temp = new ACCOUNT[SIZE*2];
for (int i= 0;i
Temp[i] = accounts[i];
}
Accounts=temp;
}
In Java, you cannot use "= =" to compare two strings, you must use Equals () as follows:
if (Str1.equals (str2)) {}
Inheritance: The entire method of reusing the parent class (good or bad). Inheritance is not recommended in the project.
Class Subclass extends parent class {}
There can be only one parent class in Java.
The parent class, like the method name of the subclass, wants to call the parent class
Person p = new person (), and the constructor method is called whenever the sentence is executed. The constructor name must be the same as the class name, and some initialization of the parameter is possible.
The generic method is not the same as the class name, when the object is created and then invoked with a reference. P.getname ();
Super. member variables, super. Member functions call methods of the parent class,
Abstract classes can have abstract methods, but also can have ordinary methods;
There are abstract methods in the class, and the class must be an abstract class;
There is an abstract method in the parent class, the subclass either overrides the abstract method of the parent class, or the subclass becomes an abstract class
Final and abstract are conflicting and cannot be written together.
The method that is modified by the final is not modifiable. (Note that the code inside the keyword finally,finally that is different from the exception is executed regardless of what happens, and is used to shut down the database after the system has been abnormally, etc. and exits safely)
Abstract can only modify classes and methods, and cannot modify properties
Java Learning Fragmented Basics 02