zoukankan      html  css  js  c++  java
  • [Training Video

    Array:

    def x = new String[5]
    x[0] = "India"
    x[1] = "USA"
    x[2] = "Korea"
    x[3] = "Japan"
    x[4] = "China"
    
    log.info "Size of list is " + x.size()
    log.info "The first item in list is : "+x[0]
    for(String item:x){
    	log.info item
    }
    

     Result :

    Tue Jun 16 14:50:08 CST 2015:INFO:Size of list is 5
    Tue Jun 16 14:50:08 CST 2015:INFO:The first item in list is : India
    Tue Jun 16 14:50:08 CST 2015:INFO:India
    Tue Jun 16 14:50:08 CST 2015:INFO:USA
    Tue Jun 16 14:50:08 CST 2015:INFO:Korea
    Tue Jun 16 14:50:08 CST 2015:INFO:Japan
    Tue Jun 16 14:50:08 CST 2015:INFO:China

    ArrayList :

    ArrayList list = new ArrayList();
    list.add("India")
    list.add("USA")
    list.add("UK")
    list.add("China")
    
    log.info "Size of list is "+list.size()
    list.add("Korea")
    
    log.info "Size of list is "+list.size()
    log.info "The first item in list is : " + list.get(0)
    
    for(String item:list){
    	log.info item
    }
    

     Result:

    Tue Jun 16 14:57:43 CST 2015:INFO:Size of list is 4
    Tue Jun 16 14:57:43 CST 2015:INFO:Size of list is 5
    Tue Jun 16 14:57:43 CST 2015:INFO:The first item in list is : India
    Tue Jun 16 14:57:43 CST 2015:INFO:India
    Tue Jun 16 14:57:43 CST 2015:INFO:USA
    Tue Jun 16 14:57:43 CST 2015:INFO:UK
    Tue Jun 16 14:57:43 CST 2015:INFO:China
    Tue Jun 16 14:57:43 CST 2015:INFO:Korea

  • 相关阅读:
    手机文件夹的emulated什么意思
    数据结构
    Django简介
    forms组件
    前端css
    mysql进阶知识
    mysql入门知识
    html文档知识补充
    前端基础
    python 面试题
  • 原文地址:https://www.cnblogs.com/MasterMonkInTemple/p/4580805.html
Copyright © 2011-2022 走看看