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. python 高阶内置函数

    1.lambda 匿名函数 lambda 参数: 返回值 函数名统一都叫lambda. 2.sorted() 排序函数 排序函数 sorted(iterable,key,reverse) key:排序 ...

  2. length length()

    数组长度 length String 长度 length()

  3. IO模型之阻塞IO

    1. IO模型的介绍 首先我们先来熟悉下什么是 同步,异步.阻塞.非阻塞 的知识: 同步(synchronous) IO和异步(asynchronous) IO,阻塞(blocking) IO和非阻塞 ...

  4. apache DOCUMENT_ROOT

    问题描述:本地页面错误,+1上正常 本地及+1apache配置 <VirtualHost *:> ServerAdmin webmaster@dummy-host.example.com ...

  5. svn关键词BASE, HEAD, COMMITTED, PREV的深入理解

    svn关键词BASE, HEAD, COMMITTED, PREV可以很方便用于日常操作中,但是很多人对他们的工作原理和方式不是太了解. 在这里我将使用用例,诠释他们的作用和意图. 先给出svn手册中 ...

  6. g++ 4.4.7 template 没问题,前面应该程序问题!!

  7. ansible初识三

    一.setup模块 ansible的 setup模块主要用来收集信息, 查看参数: [root@localhost ~]# ansible-doc -s setup # 查看参数,部分参数如下: fi ...

  8. CSS——创建css

    CreateInlineStyle: function () { //创建一个内联样式表 var style = document.createElement('style'); //创建一个styl ...

  9. 直接用SQL语句把DBF导入SQLServer

    直接用SQL语句把DBF导入SQLServer   在SQLServer中执行 SELECT * into bmk FROM OpenDataSource( ’Microsoft.Jet.OLEDB. ...

  10. linux系统构架 - LB集群之LVS的DR设置

    在lvs的nat模式的基础上 1.清空ipvsadm规则 ipvsadm -C 查看 ipvsadm -ln 2.清空iptables规则 iptables -t nat -F 3.修改rs的网卡配置 ...