[Training Video - 4] [Groovy] Function in detail
Employee.log=log Employee e1 = new Employee()
Employee e2 = new Employee()
e1.name = "A"
e1.salary = 100 e2.name = "B"
e2.salary = 200 e1.printName()
e2.printName()
def newSalary = e1.increaseSalary(100)
log.info "New salary of A is $newSalary"
e2.increaseSalary(100) log.info "Salary of $e1.name is $e1.salary"
log.info "Salary of $e2.name is $e2.salary" class Employee {
def static log
def name
def salary public void printName(){
log.info name
} public int increaseSalary(amt){
salary = salary+amt
return salary
}
}
Run Result:
Tue Oct 06 19:24:47 CST 2015:INFO:A
Tue Oct 06 19:24:47 CST 2015:INFO:B
Tue Oct 06 19:24:47 CST 2015:INFO:New salary of A is 200
Tue Oct 06 19:24:47 CST 2015:INFO:Salary of A is 200
Tue Oct 06 19:24:47 CST 2015:INFO:Salary of B is 300
[Training Video - 4] [Groovy] Function in detail的更多相关文章
- [Training Video - 3] [Groovy in Detail] Non-static and Static functions, initializing log inside class
log.info "starting" // we use class to create objects of a class Planet p1 = new Planet() ...
- [Training Video - 3] [Groovy in Detail] Non-static and Static variables, objects and object referances
log.info "starting" // we use class to create objects of a class Planet p1 = new Planet() ...
- [Training Video - 3] [Groovy in Detail] What is a groovy class ?
log.info "starting" // we use class to create objects of a class Planet p1 = new Planet() ...
- [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 - 4] [Groovy] Optional parameter in groovy
Employee.log=log Employee e1 = new Employee() log.info e1.add(1,2,3,4) // optional parameters in gro ...
- [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 - 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" ...
- [Training Video - 4] [Groovy] String Functions
def x="I like to read books before bed" def temp = x.split(" ") log.info "S ...
随机推荐
- 获取响应数据___JSON Extractor 后置处理器
对于大部分请求返回的结果,都是json,有一个更方便使用的插件:JSON Extractor 不过得首先下载插件 https://jmeter-plugins.org/wiki/JSONPathExt ...
- Appium ios新的定位方式FindsByIosNSPredicate (没有试 先记录在这里) 有个 driver.find_element_by_ios_uiautomation() 研究下 ios的定位
这个定位方式需要用java-client -5.0.版本,4.x的版本没有这个定位方式 //输入账号和密码 driver.findElementByIosNsPredicate("value ...
- mysql-5.6.17编译安装和常见问题
mysql-5.6.17编译安装和常见问题 以前用的是MySQL的5.1版本,且使用的是免编译的包,安装简单.最近换了5.6版本的MySQL,安装过程出现了不少问题. 1. 卸载原来版本的MySQL ...
- 一次hadoop集群机器加内存的运维过程
由于前期的集群规划问题,导致当前Hadoop集群中的硬件并没有完全利用起来.当前机器的内存CPU比例为2G:1core,但一般的MapReduce任务(数据量处理比较大,逻辑较复杂)的MR两端都需要将 ...
- STS - 配置Tomcat 运行路径
背景 今天在一台新机器上面安装开发环境,下载完code以后在STS上配置Tomcat,发现启动以后无法读取到配置文件...启动失败! 七月 , :: 上午 org.apache.catalina.co ...
- js获取页面名称和路径参数
// 取当前页面名称(不带后缀名)function getPageName1(){ var a = location.href; var b = a.split("/" ...
- Oracle ASM操作管理
查看ASM磁盘情况 SQL> select group_number,disk_number,mount_status,header_status,mode_status,state,failg ...
- [POJ] The Triangle
The Triangle Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 47278 Accepted: 28608 De ...
- 【转】Android Studio打包全攻略---从入门到精通
原文地址:http://blog.csdn.net/zivensonice/article/details/51672846 初出茅庐 手动打包 怎么手动打包 项目写完了,现在需要把应用上传到市场,问 ...
- Flask之视图(一)
2.关于Flask 知识点 从Hello World开始 给路由传递参数 返回状态码 重定向 正则URL 设置cookie和获取cookie 扩展 上下文 请求钩子 Flask装饰器路由的实现 Fla ...