Concept
1. The method modified by static is a static method. Static methods do not need to be called by instance objects and can be called directly using Class.method. For example, LocalDate.now() provided by JDK8 is a typical static method, which returns the current time
2. Non-static methods are common methods without static, which usually require the object to be initialized before calling. The above validate and getValue are non-static methods that are called after instantiating the User object
Instance
public static LocalDate now() { return now(Clock.systemDefaultZone()); }
Java Basic data types are divided into:
1. Integer type, used to represent the data type of integers.
2. Floating point type, a data type used to represent decimals.
3. Character type. The keyword of character type is "char".
4. Boolean type is the basic data type that represents logical values.
The above is the detailed content of What is the definition and difference between static methods and non-static methods in Java?. For more information, please follow other related articles on the PHP Chinese website!