package com.test;

interface product{
    
    int getPrice();
}
public class News {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        
        //直接实例化接口,并实现接口的方法
    int pricene=new product(){
            public int getPrice(){
                
                return 100;
                
            }            
        }.getPrice();

        System.out.println(pricene);
    }



}

参考 http://blog.csdn.net/zhengguanxiong/article/details/52517127

相关文章:

  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-11-28
  • 2021-10-10
  • 2021-06-22
猜你喜欢
  • 2021-08-30
  • 2022-01-15
  • 2022-01-18
  • 2021-07-10
相关资源
相似解决方案