Files
javaSE-0419/day10/src/com/inmind/interface_constatnt05/Demo04.java

18 lines
792 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.inmind.interface_constatnt05;
/*
接口中的内容特点:
1.抽象方法jdk7之前制定规则必须遵守的规范
2.默认方法jdk8优化解决接口升级的问题选择性地沿用或者扩展新功能
3.静态方法jdk8定义一些跟接口本身相关的通用的工具类方法
4.私有方法jdk9: 对默认方法和静态方法,进行共有代码的抽取复用,且不让外界调用
5.常量:定义了公共的标准值,为接口的行为提供规范,配套的固定值
*/
public class Demo04 {
public static void main(String[] args) {
//使用接口中定义的“成员变量”
System.out.println(MyInterfaceConstatnt.num);
System.out.println(MyInterfaceConstatnt.num1);
}
}