Home > Java > javaTutorial > How to implement static binding in java

How to implement static binding in java

WBOY
Release: 2023-04-30 22:22:05
forward
745 people have browsed it

Concept

1. Static binding is also called early binding and compile-time binding.

2. The method has been bound before the program is executed (that is to say, during the compilation process, it is already known which class the method is in), which is implemented by the compiler or other linker.

3. Among the methods in Java, only final, static, private modified methods and constructors are statically bound.

Example

//被调用的类
package hr.test;
class Father{
      public static void f1(){
              System.out.println("Father— f1()");
      }
}
//调用静态方法
import hr.test.Father;
public class StaticCall{
       public static void main(){
            Father.f1(); //调用静态方法
       }
}
Copy after login

The above is the detailed content of How to implement static binding in java. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template