1.8 Basic data types
Integral type: byte short int long
Float type: float double
Character type: Char
Boolean type: True,false
Java type, + on both sides of the default is an int type cast example: int a = four byte num = (byte) a
2. Reference data type: String class
3. Naming conventions
A. Class names cannot start with numbers, special symbols, lowercase letters
b, using small hump-type naming
c, do see the name of the idea
Package naming: All lowercase company names. Name of the project.
4. Array 1. Array type identifier [] = new data type {value 1, value 2}
2. Array type identifier []= {value 1, value 2}
5. Functions
Format: Permission modifier return value type function name (type parameter) {}
Example public String Demo () {
}
6. Object-oriented
Features: Encapsulation inheritance polymorphism
Create object class Name Object name = new class name ();
Invocation of the method
static invocation of static class name calls static invoke non-static instantiation call
1. Anonymous objects
Definition: An object without a name
Features: 1. No meaning when assigning a value to a property
2. Used when calling the method, and can only use 1 times
3. Can be used as a parameter pass
2. Blood Loss model-encapsulation
Definition: Hides the properties and implementation details of an object, providing only public access.
Function: Hide detail security to improve code reuse
Principle: Hide content that does not need to be provided externally and provide interfaces using getter and setter methods.
This keyword: a reference to the current object to distinguish between local variables and global variables with duplicate names
Overloading (overload): In the same class, the method name is identical, and the parameter list [parameter type Order] is different, regardless of the return value.
Summary of Java Basics