[Training Video - 4] [Groovy] Optional parameter in groovy
Employee.log=log
Employee e1 = new Employee() log.info e1.add(1,2,3,4)
// optional parameters in groovy
log.info e1.add(2,3)
log.info e1.add(2,3,10) class Employee {
def static log public def add(a,b,c=3,d=10){
return a+b+c+d
}
}
Run result:
Tue Oct 06 19:31:50 CST 2015:INFO:10
Tue Oct 06 19:31:50 CST 2015:INFO:18
Tue Oct 06 19:31:50 CST 2015:INFO:25
[Training Video - 4] [Groovy] Optional parameter in groovy的更多相关文章
- Groovy轻松入门——搭建Groovy开发环境
摘自: http://www.blogjava.net/BlueSUN/archive/2007/03/17/104391.html Groovy轻松入门--搭建Groovy开发环境 多日来,我发表了 ...
- Java 调用 groovy 脚本文件,groovy 访问 MongoDB
groovy 访问 MongoDB 示例: shell.groovy package db import com.gmongo.GMongoClient import com.mongodb.Basi ...
- Groovy学习()Groovy是啥?
Groovy是啥? groovy是英文中的一个单词,有marvelous.wonderful和excellen的意思. groovy是轻量级的,动态的,面向对象的,并且运行在JVM上的. groovy ...
- [Training Video - 2] [Groovy Introduction]
Building test suites, Test cases and Test steps in SOAP UI Levels : test step level test case level ...
- [Training Video - 7] [Database connection] Various databases which are supported, Drivers for database connection, SQL Groovy API
Various databases which are supported Drivers for database connection groovy.sql.Sql package SoapUI怎 ...
- [Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Exception Handling in groovy
def x = new String[3] x[0] = "A" x[1] = "B" x[2] = "C" log.info"X ...
- [Training Video - 6] [File Reading] [Groovy] Reading Properties file
Reading Properties file : Properties prop = new Properties() def path = "D:\\SoapUIStudy\\appli ...
- [Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] HashSet and Hashtable
Hashset: HashSet set = new HashSet() set.add("India") set.add("USA") set.add(&qu ...
- [Training Video - 5] [Groovy Script Test Step - Collections, Exceptions] Array and ArrayList
Array: def x = new String[5] x[0] = "India" x[1] = "USA" x[2] = "Korea" ...
随机推荐
- 在Google的GKE上创建支持Internal Load Balancer的Service
在Google的Kubernetes Engine上发布service,可以采用除On-Promise相同的Cluster IP和NodePort两种方式外,还可以创建LoadBalaner的Serv ...
- C++中如何在顺序容器中删除符合特定条件的元素
以前很少做删除操作,vector一直当成数组用,而实际追求效率时又经常舍弃vector选用C风格数组.看<C++ Primer>到顺序容器删除这节时试着实现课后习题结果一动手我就出错了. ...
- spring AOP 之五:Spring MVC通过AOP切面编程来拦截controller
示例1:通过包路径及类名规则为应用增加切面 该示例是通过拦截所有com.dxz.web.aop包下的以Controller结尾的所有类的所有方法,在方法执行前后打印和记录日志到数据库. 新建一个spr ...
- python学习 (三十四) Python文件操作
1 写文件 my_list = ["] my_file = open("myfile.txt", "w") for item in my_list: ...
- node.js 获取客户端信息
结果:
- Android:ScrollView和SwipeRefreshLayout高度测量
今天组里的同事要做一个奇葩的效果,要求在ScrollView里嵌套一个RefreshLayout.类似代码如下: <?xml version="1.0" encoding=& ...
- Python添加模块
参考博客:http://blog.csdn.net/damotiansheng/article/details/43916881 http://my.oschina.net/leejun2005/bl ...
- Tkinter Bitmaps
Tkinter Bitmaps: 你会使用这个属性显示一个位图.有以下类型的可用位图. 你会使用这个属性显示一个位图.有以下类型的可用位图.: "error" "g ...
- python实现cifar10数据集的可视化
在学习tensorflow的mnist和cifar实例的时候,官方文档给出的讲解都是一张张图片,直观清晰,当我们看到程序下载下来的数据的时候,宝宝都惊呆了,都是二进制文件,这些二进制文件还不小,用文本 ...
- 象棋AI算法(二)
原文大神是用html5+js写的关于象棋AI的博客,里面重点讲了棋子的着法,自己设计的评估函数和简单的Minmax理论,没有具体的讲搜索算法,本文是对原文的学习和分析补充 一,棋子的着法com.byl ...