1.使用说明
我们将能够与匿名实现类共同使用钻石操作符(diamond operator)
在java8中如下的操作是会报错的:
![技术分享图片](https://upload-images.jianshu.io/upload_images/9654439-4038e3bee9d902aa.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/661)
编译报错信息:‘<>‘ cannot be used with anonymous classes
2.使用举例
![技术分享图片](https://upload-images.jianshu.io/upload_images/9654439-e4208e640dbf816c.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/668)
![技术分享图片](https://upload-images.jianshu.io/upload_images/9654439-fcc9cfd097fce8e7.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/664)
Posted 王振龙
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java9新特性-8-语法改进:钻石操作符(Diamond Operator)使用升级相关的知识,希望对你有一定的参考价值。
我们将能够与匿名实现类共同使用钻石操作符(diamond operator)
在java8中如下的操作是会报错的:
编译报错信息:‘<>‘ cannot be used with anonymous classes
以上是关于java9新特性-8-语法改进:钻石操作符(Diamond Operator)使用升级的主要内容,如果未能解决你的问题,请参考以下文章