Bank.log = log

Bank b1 = new Bank()
b1.name = "BOA"
b1.minbalance = 100
b1.city="London" Bank b2 = new Bank()
b2.name = "HSBC"
b2.minbalance = 100
b2.city="LA" Bank b3 = new Bank("A",100,"X")
log.info b3.name
Bank b4 = new Bank("B",1200,"X1")
Bank b5 = new Bank("C",1300,"X2")
log.info b5.minbalance class Bank{
def static log
def name
def minbalance
def city public Bank(){ // no return type, same name with class name
log.info "inside constructor"
} // public Bank(bankName,bankMinBal,bankCity){
// name = bankName
// minbalance = bankMinBal
// city = bankCity
// } public Bank(name,minbalance,city){
this.name = name
this.minbalance = minbalance
this.city = city
}
}

Run result:

Tue Oct 06 19:51:29 CST 2015:INFO:inside constructor
Tue Oct 06 19:51:29 CST 2015:INFO:inside constructor
Tue Oct 06 19:51:29 CST 2015:INFO:A
Tue Oct 06 19:51:29 CST 2015:INFO:1300

[Training Video - 4] [Groovy] Constructors in groovy, this keyword的更多相关文章

  1. [Training Video - 2] [Groovy Introduction]

    Building test suites, Test cases and Test steps in SOAP UI Levels : test step level test case level ...

  2. Error:Cannot compile Groovy files: no Groovy library is defined for module 'xxxx' 错误处理

    出现 Error:Cannot compile Groovy files: no Groovy library is defined for module 'xxxx' 只要在 project str ...

  3. Groovy学习记录-------Groovy安装/配置

    1.Groovy SDK下载 Groovy SDK官网下载地址: http://www.groovy-lang.org/download.html  每个版本有五个选项可供下载,依次为: binary ...

  4. [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 ...

  5. [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怎 ...

  6. [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 ...

  7. [Training Video - 6] [File Reading] [Groovy] Reading Properties file

    Reading Properties file : Properties prop = new Properties() def path = "D:\\SoapUIStudy\\appli ...

  8. [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 ...

  9. [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" ...

随机推荐

  1. JAVA-Unit02: Oracle字符串操作 、 Oracle数值操作 、 Oracle日期操作 、 空值操作

    Unit02: Oracle字符串操作 . Oracle数值操作 . Oracle日期操作 . 空值操作 DQL数据查询语言 查询语句基本由SELECT子句由FROM子句构成. SELECT子句指定要 ...

  2. php常用字符串数组函数

    Php常用的数组函数 键值操作 Array_values($arr) 获取数据的值 Array_keys($arr) 获取数组的key Array_flip($arr) 数组键值反转 In_array ...

  3. FPGA常用设计思想与基本模块划分

    常用设计思想与技巧 (1)乒乓操作; (2)串并转换; (3)流水线操作; (4)异步时钟域数据同步.是指如何在两个时钟不同步的数据域之间可靠地进行数据交换的问题.数据时钟域不同步主要有两种情况: ① ...

  4. 一个for循环写出9*9乘法表

    public class ClassTest03 { public static void main(String[] args) { for(int i=1,j=1;j<=9;j++){ if ...

  5. Apache common exec包的相应使用总结

      最近在写一个Java工具,其中调用了各种SHELL命令,使用了Runtime.getRuntime().exec(command);这个方法.但是在我调用某个命令执行操作时,程序就卡在那了,但是其 ...

  6. 10g RAC常用开启关闭命令 – SRVCTL用法

    10G RAC: srvctl 1. Grammar: srvctl <command> <object> [<options]] available <comma ...

  7. SQLserver2008全文检索使用方法

    一.开启SQL Full-text服务: 保证 SQL Full-text Filter Daemon Launcher服务处于开启状态,不同版本SQLServer全文检索服务名称可能稍有不同,如果服 ...

  8. Java Thread 多线程同步、锁、通信

    参看:http://www.cnblogs.com/hoojo/archive/2011/05/05/2038101.html

  9. [Python] Request module

    http://docs.python-requests.org/zh_CN/latest/user/quickstart.html

  10. Mybit错误,提示There is no getter for property named 'tid' in 'class java.lang.String'

    改成 <select id="queryStudentByNum" resultType="student" parameterType="st ...