//如果接口只有一个方法,可以通过闭包,用下面的方式来实现: // a readable puts chars into a CharBuffer and returns the count of chars added def readable = { it.put("12 34".reverse()); 5 } as Readable // the Scanner constructor can take a Readable def s = new Scanner(readable) assert s.nextInt() == 43
用户登录
还没有账号?立即注册
用户注册
投稿取消
文章分类: |
|
还能输入300字
上传中....